jayebaku commited on
Commit
d6dd9fc
·
verified ·
1 Parent(s): de89642

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -8
app.py CHANGED
@@ -61,8 +61,8 @@ def calculate_accuracy(flood_selections, fire_selections, none_selections, num_p
61
  data_df.to_csv("output.csv")
62
  return incorrect, correct, accuracy, data_df, gr.DownloadButton(label=f"Download CSV", value="output.csv", visible=True)
63
 
64
- def get_queries():
65
- queries = [
66
  "What areas are being evacuated?",
67
  "What areas are predicted to be impacted?",
68
  "What areas are without power?",
@@ -84,7 +84,34 @@ def get_queries():
84
  "Where has road damage occured?",
85
  "What area has the wildfire burned?",
86
  "Where have homes been damaged or destroyed?"]
87
- return gr.CheckboxGroup(choices=queries)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  with gr.Blocks() as demo:
90
  event_models = ["jayebaku/distilbert-base-multilingual-cased-crexdata-relevance-classifier"]
@@ -177,13 +204,17 @@ with gr.Blocks() as demo:
177
  - Parameters for QA can be editted in sidebar\n
178
  """)
179
  selected_queries = gr.CheckboxGroup(label="Select at least one query using the checkboxes", interactive=True)
180
- qa_tab.select(get_queries, None, selected_queries)
 
 
181
  qa_button = gr.Button("Start QA")
 
 
182
  analysis_output = gr.DataFrame(headers=["Selected Text", "Analysis"])
183
- qa_button.click(qa_process, inputs=selected_queries, outputs=analysis_output)
 
184
 
185
- # analysis_button = gr.Button("Analyze Selected Texts")
186
- # analysis_output = gr.DataFrame(headers=["Selected Text", "Analysis"])
187
- # analysis_button.click(analyze_selected_texts, inputs=flood_checkbox_output, outputs=analysis_output)
188
 
189
  demo.launch()
 
61
  data_df.to_csv("output.csv")
62
  return incorrect, correct, accuracy, data_df, gr.DownloadButton(label=f"Download CSV", value="output.csv", visible=True)
63
 
64
+ def get_queries(to_add, history):
65
+ history = history or [
66
  "What areas are being evacuated?",
67
  "What areas are predicted to be impacted?",
68
  "What areas are without power?",
 
84
  "Where has road damage occured?",
85
  "What area has the wildfire burned?",
86
  "Where have homes been damaged or destroyed?"]
87
+
88
+
89
+ # queries = [
90
+ # "What areas are being evacuated?",
91
+ # "What areas are predicted to be impacted?",
92
+ # "What areas are without power?",
93
+ # "What barriers are hindering response efforts?",
94
+ # "What events have been canceled?",
95
+ # "What preparations are being made?",
96
+ # "What regions have announced a state of emergency?",
97
+ # "What roads are blocked / closed?",
98
+ # "What services have been closed?",
99
+ # "What warnings are currently in effect?",
100
+ # "Where are emergency services deployed?",
101
+ # "Where are emergency services needed?",
102
+ # "Where are evacuations needed?",
103
+ # "Where are people needing rescued?",
104
+ # "Where are recovery efforts taking place?",
105
+ # "Where has building or infrastructure damage occurred?",
106
+ # "Where has flooding occured?"
107
+ # "Where are volunteers being requested?",
108
+ # "Where has road damage occured?",
109
+ # "What area has the wildfire burned?",
110
+ # "Where have homes been damaged or destroyed?"]
111
+ if to_add != "dummy":
112
+ history.append(to_add)
113
+
114
+ return gr.CheckboxGroup(choices=history), history
115
 
116
  with gr.Blocks() as demo:
117
  event_models = ["jayebaku/distilbert-base-multilingual-cased-crexdata-relevance-classifier"]
 
204
  - Parameters for QA can be editted in sidebar\n
205
  """)
206
  selected_queries = gr.CheckboxGroup(label="Select at least one query using the checkboxes", interactive=True)
207
+ dummy_arg = gr.Textbox(visible=False, value="dummy")
208
+ qa_tab.select(get_queries, inputs=[dummy_arg, "state"], outputs=selected_queries)
209
+
210
  qa_button = gr.Button("Start QA")
211
+
212
+
213
  analysis_output = gr.DataFrame(headers=["Selected Text", "Analysis"])
214
+
215
+
216
 
217
+ qa_button.click(qa_process, inputs=selected_queries, outputs=analysis_output)
218
+
 
219
 
220
  demo.launch()