File size: 1,001 Bytes
3b9fb2c
 
306e33b
 
 
 
 
3b9fb2c
306e33b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr

# Step 1: Textbox input
# For now, we wire the textbox to a dummy function. We'll later replace `dummy_inference` with your model call.
def dummy_inference(query: str) -> str:
    # TODO: replace with actual NER+RE model inference
    return f"Model received: '{query}'"

with gr.Blocks(title="Step 1: Input Box Demo") as demo:
    gr.Markdown("""
    ## Step 1: Implement a Text Input
    Enter any text below. On submit, it will echo back the value.  
    This is where your NER + relation-extraction model will later consume the query.
    """
    )
    query_input = gr.Textbox(
        lines=4,
        placeholder="Type your text here...",
        label="Input Text",
    )
    submit_btn = gr.Button("Submit")
    output_box = gr.Textbox(
        lines=2,
        label="Echoed Output",
    )
    submit_btn.click(
        fn=dummy_inference,
        inputs=[query_input],
        outputs=[output_box],
    )

demo.queue(default_concurrency_limit=5)
demo.launch(debug=True)