Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,6 +86,10 @@ def init_queries(history):
|
|
| 86 |
"Where have homes been damaged or destroyed?"]
|
| 87 |
|
| 88 |
return gr.CheckboxGroup(choices=history), history
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
with gr.Blocks() as demo:
|
| 91 |
event_models = ["jayebaku/distilbert-base-multilingual-cased-crexdata-relevance-classifier"]
|
|
@@ -182,7 +186,7 @@ with gr.Blocks() as demo:
|
|
| 182 |
queries_state = gr.State()
|
| 183 |
qa_tab.select(init_queries, inputs=queries_state, outputs=[selected_queries, queries_state])
|
| 184 |
|
| 185 |
-
|
| 186 |
addqry_button = gr.Button("Add to queries")
|
| 187 |
qa_button = gr.Button("Start QA")
|
| 188 |
|
|
@@ -190,7 +194,7 @@ with gr.Blocks() as demo:
|
|
| 190 |
analysis_output = gr.DataFrame(headers=["Selected Text", "Analysis"])
|
| 191 |
|
| 192 |
|
| 193 |
-
|
| 194 |
qa_button.click(qa_process, inputs=selected_queries, outputs=analysis_output)
|
| 195 |
|
| 196 |
|
|
|
|
| 86 |
"Where have homes been damaged or destroyed?"]
|
| 87 |
|
| 88 |
return gr.CheckboxGroup(choices=history), history
|
| 89 |
+
|
| 90 |
+
def add_query(to_add, history):
|
| 91 |
+
history.append(to_add)
|
| 92 |
+
return gr.CheckboxGroup(choices=history), history
|
| 93 |
|
| 94 |
with gr.Blocks() as demo:
|
| 95 |
event_models = ["jayebaku/distilbert-base-multilingual-cased-crexdata-relevance-classifier"]
|
|
|
|
| 186 |
queries_state = gr.State()
|
| 187 |
qa_tab.select(init_queries, inputs=queries_state, outputs=[selected_queries, queries_state])
|
| 188 |
|
| 189 |
+
query_inp = gr.Textbox(label="Add custom queries like the one above, one at a time")
|
| 190 |
addqry_button = gr.Button("Add to queries")
|
| 191 |
qa_button = gr.Button("Start QA")
|
| 192 |
|
|
|
|
| 194 |
analysis_output = gr.DataFrame(headers=["Selected Text", "Analysis"])
|
| 195 |
|
| 196 |
|
| 197 |
+
addqry_button.click(add_query, inputs=[query_inp, queries_state], outputs=[selected_queries, queries_state])
|
| 198 |
qa_button.click(qa_process, inputs=selected_queries, outputs=analysis_output)
|
| 199 |
|
| 200 |
|