Spaces:
Running
Running
Commit
·
306e33b
1
Parent(s):
3b9fb2c
iteration
Browse files
app.py
CHANGED
@@ -1,7 +1,33 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Step 1: Textbox input
|
4 |
+
# For now, we wire the textbox to a dummy function. We'll later replace `dummy_inference` with your model call.
|
5 |
+
def dummy_inference(query: str) -> str:
|
6 |
+
# TODO: replace with actual NER+RE model inference
|
7 |
+
return f"Model received: '{query}'"
|
8 |
|
9 |
+
with gr.Blocks(title="Step 1: Input Box Demo") as demo:
|
10 |
+
gr.Markdown("""
|
11 |
+
## Step 1: Implement a Text Input
|
12 |
+
Enter any text below. On submit, it will echo back the value.
|
13 |
+
This is where your NER + relation-extraction model will later consume the query.
|
14 |
+
"""
|
15 |
+
)
|
16 |
+
query_input = gr.Textbox(
|
17 |
+
lines=4,
|
18 |
+
placeholder="Type your text here...",
|
19 |
+
label="Input Text",
|
20 |
+
)
|
21 |
+
submit_btn = gr.Button("Submit")
|
22 |
+
output_box = gr.Textbox(
|
23 |
+
lines=2,
|
24 |
+
label="Echoed Output",
|
25 |
+
)
|
26 |
+
submit_btn.click(
|
27 |
+
fn=dummy_inference,
|
28 |
+
inputs=[query_input],
|
29 |
+
outputs=[output_box],
|
30 |
+
)
|
31 |
+
|
32 |
+
demo.queue(default_concurrency_limit=5)
|
33 |
+
demo.launch(debug=True)
|