rafmacalaba's picture
iteration
306e33b
raw
history blame
1 kB
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)