File size: 1,542 Bytes
dc07399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from extraction import paragraph_extract

def predict(paragraphs, positions):
    paragraphs = [paragraphs]
    positions = [positions]
    return extractor(paragraphs, positions)[0]

extractor = paragraph_extract().extract

example_paragraph = 'The W/Zr/HfO2 /TiN structure was fabricated following the scheme shown in the inset of Fig. 1(a). A 5-nm-thick HfO2 layer was deposited on a TiN substrate by an atomic layer deposition system. After HfO2 film deposition, thermal annealing was performed under NH3 at 700∘C in order to achieve optimum concentration of oxygen vacancies [10]. Then, the 3-nm-thick Zr top electrode and a 50-nm-thick W capping layer were deposited by RF magnetron sputtering system. The size of the upper electrode was 10×10 μm2 . The electrical measurements were performed by an Agilent B1500A semiconductor device analyzer, equipped with two pulse generator modules WGFMU (Waveform Generator and Fast Measurement Unit). The coaxial cables with a 50-Ω resistance and less than 10 cm in length were used to reduce the parasitic effects.'
example_position = 4

demo = gr.Interface(fn=predict, inputs=[gr.inputs.Textbox(lines=3, label="Paragraphs", placeholder='Text Here...'), 
                                        gr.inputs.Number(label="Positions")], 
                    outputs="text", 
                    title="ReRAM Paragraph Classification", allow_flagging=False,
                    examples=[[example_paragraph, example_position]],
                    )

demo.launch(share=True)