Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse filesShow JSON output
app.py
CHANGED
|
@@ -149,11 +149,11 @@ with gr.Blocks(title="GLiNER-query-parser") as demo:
|
|
| 149 |
scale=0,
|
| 150 |
)
|
| 151 |
|
| 152 |
-
# output = gr.JSON(label="Extracted entities")
|
| 153 |
-
|
| 154 |
output = gr.HighlightedText(label="Annotated entities")
|
| 155 |
submit_btn = gr.Button("Submit")
|
| 156 |
-
|
|
|
|
|
|
|
| 157 |
|
| 158 |
# Submitting
|
| 159 |
query.submit(
|
|
@@ -174,8 +174,8 @@ with gr.Blocks(title="GLiNER-query-parser") as demo:
|
|
| 174 |
model_name.change(
|
| 175 |
fn=annotate_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 176 |
)
|
| 177 |
-
|
| 178 |
-
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=
|
| 179 |
)
|
| 180 |
|
| 181 |
demo.queue(default_concurrency_limit=5)
|
|
|
|
| 149 |
scale=0,
|
| 150 |
)
|
| 151 |
|
|
|
|
|
|
|
| 152 |
output = gr.HighlightedText(label="Annotated entities")
|
| 153 |
submit_btn = gr.Button("Submit")
|
| 154 |
+
|
| 155 |
+
json_output = gr.JSON(label="Extracted entities")
|
| 156 |
+
json_button = gr.Button("Get JSON")
|
| 157 |
|
| 158 |
# Submitting
|
| 159 |
query.submit(
|
|
|
|
| 174 |
model_name.change(
|
| 175 |
fn=annotate_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=output
|
| 176 |
)
|
| 177 |
+
json_button.click(
|
| 178 |
+
fn=parse_query, inputs=[query, entities, threshold, is_nested, model_name], outputs=json_output
|
| 179 |
)
|
| 180 |
|
| 181 |
demo.queue(default_concurrency_limit=5)
|