Spaces:
Running
Running
Commit
·
c35975c
1
Parent(s):
306e33b
iteration 2
Browse files
app.py
CHANGED
@@ -1,26 +1,46 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
# Step 1: Textbox input
|
4 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
)
|
16 |
query_input = gr.Textbox(
|
17 |
lines=4,
|
18 |
-
|
19 |
label="Input Text",
|
|
|
20 |
)
|
21 |
submit_btn = gr.Button("Submit")
|
22 |
output_box = gr.Textbox(
|
23 |
-
lines=
|
24 |
label="Echoed Output",
|
25 |
)
|
26 |
submit_btn.click(
|
@@ -29,5 +49,8 @@ with gr.Blocks(title="Step 1: Input Box Demo") as demo:
|
|
29 |
outputs=[output_box],
|
30 |
)
|
31 |
|
32 |
-
demo
|
33 |
-
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
# Step 1: Textbox input
|
4 |
+
# Define relation types and sample text
|
5 |
+
rels = [
|
6 |
+
'acronym',
|
7 |
+
'author',
|
8 |
+
'data description',
|
9 |
+
'data geography',
|
10 |
+
'data source',
|
11 |
+
'data type',
|
12 |
+
'publication year',
|
13 |
+
'publisher',
|
14 |
+
'reference year',
|
15 |
+
'version'
|
16 |
+
]
|
17 |
+
sample_text = (
|
18 |
+
"Recent studies on ocean currents from the Global Ocean Temperature Dataset (GOTD) "
|
19 |
+
"indicate significant shifts in marine biodiversity."
|
20 |
+
)
|
21 |
+
|
22 |
+
# Dummy inference echoes input + relations
|
23 |
def dummy_inference(query: str) -> str:
|
24 |
# TODO: replace with actual NER+RE model inference
|
25 |
+
return f"Model received: '{query}' with relations: {rels}"
|
26 |
|
27 |
with gr.Blocks(title="Step 1: Input Box Demo") as demo:
|
28 |
+
gr.Markdown(
|
29 |
+
"""
|
30 |
+
## Step 1: Implement a Text Input
|
31 |
+
Enter any text below (prepopulated with a sample).
|
32 |
+
This is where your NER + relation-extraction model will later consume the query.
|
33 |
+
"""
|
34 |
)
|
35 |
query_input = gr.Textbox(
|
36 |
lines=4,
|
37 |
+
value=sample_text,
|
38 |
label="Input Text",
|
39 |
+
placeholder="Type your text here...",
|
40 |
)
|
41 |
submit_btn = gr.Button("Submit")
|
42 |
output_box = gr.Textbox(
|
43 |
+
lines=3,
|
44 |
label="Echoed Output",
|
45 |
)
|
46 |
submit_btn.click(
|
|
|
49 |
outputs=[output_box],
|
50 |
)
|
51 |
|
52 |
+
# Launch the demo
|
53 |
+
if __name__ == "__main__":
|
54 |
+
demo.queue(default_concurrency_limit=5)
|
55 |
+
demo.launch(debug=True)
|
56 |
+
|