Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
78762bd
1
Parent(s):
1938c90
Add model_name to args
Browse filesSigned-off-by: Aivin V. Solatorio <avsolatorio@gmail.com>
app.py
CHANGED
|
@@ -73,6 +73,11 @@ with gr.Blocks(title="GLiNER-query-parser") as demo:
|
|
| 73 |
value="gdp of the philippines in 2024", label="query", placeholder="Enter your query here"
|
| 74 |
)
|
| 75 |
with gr.Row() as row:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
entities = gr.Textbox(
|
| 77 |
value="country, year, indicator",
|
| 78 |
label="entities",
|
|
@@ -100,20 +105,38 @@ with gr.Blocks(title="GLiNER-query-parser") as demo:
|
|
| 100 |
|
| 101 |
# Submitting
|
| 102 |
query.submit(
|
| 103 |
-
fn=parse_query, inputs=[query, entities, threshold, is_nested], outputs=output
|
| 104 |
)
|
| 105 |
entities.submit(
|
| 106 |
-
fn=parse_query, inputs=[query, entities, threshold, is_nested], outputs=output
|
| 107 |
)
|
| 108 |
threshold.release(
|
| 109 |
-
fn=parse_query, inputs=[query, entities, threshold, is_nested], outputs=output
|
| 110 |
)
|
| 111 |
submit_btn.click(
|
| 112 |
-
fn=parse_query, inputs=[query, entities, threshold, is_nested], outputs=output
|
| 113 |
)
|
| 114 |
is_nested.change(
|
| 115 |
-
fn=parse_query, inputs=[query, entities, threshold, is_nested], outputs=output
|
|
|
|
|
|
|
|
|
|
| 116 |
)
|
| 117 |
|
| 118 |
-
demo.queue()
|
| 119 |
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
value="gdp of the philippines in 2024", label="query", placeholder="Enter your query here"
|
| 74 |
)
|
| 75 |
with gr.Row() as row:
|
| 76 |
+
model_name = gr.Radio(
|
| 77 |
+
choices=["urchade/gliner_medium-v2.1", "urchade/gliner_base"],
|
| 78 |
+
value="urchade/gliner_medium-v2.1",
|
| 79 |
+
label="Model",
|
| 80 |
+
)
|
| 81 |
entities = gr.Textbox(
|
| 82 |
value="country, year, indicator",
|
| 83 |
label="entities",
|
|
|
|
| 105 |
|
| 106 |
# Submitting
|
| 107 |
query.submit(
|
| 108 |
+
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 109 |
)
|
| 110 |
entities.submit(
|
| 111 |
+
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 112 |
)
|
| 113 |
threshold.release(
|
| 114 |
+
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 115 |
)
|
| 116 |
submit_btn.click(
|
| 117 |
+
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 118 |
)
|
| 119 |
is_nested.change(
|
| 120 |
+
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 121 |
+
)
|
| 122 |
+
model_name.change(
|
| 123 |
+
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 124 |
)
|
| 125 |
|
| 126 |
+
demo.queue(default_concurrency_limit=5)
|
| 127 |
demo.launch(debug=True)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
"""
|
| 131 |
+
from gradio_client import Client
|
| 132 |
+
|
| 133 |
+
client = Client("avsolatorio/query-parser")
|
| 134 |
+
result = client.predict(
|
| 135 |
+
query="gdp, m3, and child mortality of india and southeast asia 2024",
|
| 136 |
+
labels="country, year, statistical indicator, region",
|
| 137 |
+
threshold=0.3,
|
| 138 |
+
nested_ner=False,
|
| 139 |
+
api_name="/parse_query"
|
| 140 |
+
)
|
| 141 |
+
print(result)
|
| 142 |
+
"""
|