jayebaku commited on
Commit
1d42bf8
·
verified ·
1 Parent(s): 6a6a66e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -25
app.py CHANGED
@@ -58,7 +58,29 @@ def calculate_accuracy(flood_selections, fire_selections, none_selections, num_p
58
  return incorrect, correct, accuracy, data_df, gr.DownloadButton(label=f"Download CSV", value="output.csv", visible=True)
59
 
60
  def get_queries():
61
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  with gr.Blocks() as demo:
64
  event_models = ["jayebaku/distilbert-base-multilingual-cased-crexdata-relevance-classifier"]
@@ -135,32 +157,14 @@ with gr.Blocks() as demo:
135
  calculate_accuracy,
136
  inputs=[flood_checkbox_output, fire_checkbox_output, none_checkbox_output, num_posts, text_field, data],
137
  outputs=[incorrect, correct, accuracy, data_eval, download_csv])
138
-
139
- with gr.Tab("Question Answering"):
 
 
 
140
  # XXX Add some button disabling here, if the classification process is not completed first XXX
141
 
142
- queries = [
143
- "What areas are being evacuated?",
144
- "What areas are predicted to be impacted?",
145
- "What areas are without power?",
146
- "What barriers are hindering response efforts?",
147
- "What events have been canceled?",
148
- "What preparations are being made?",
149
- "What regions have announced a state of emergency?",
150
- "What roads are blocked / closed?",
151
- "What services have been closed?",
152
- "What warnings are currently in effect?",
153
- "Where are emergency services deployed?",
154
- "Where are emergency services needed?",
155
- "Where are evacuations needed?",
156
- "Where are people needing rescued?",
157
- "Where are recovery efforts taking place?",
158
- "Where has building or infrastructure damage occurred?",
159
- "Where has flooding occured?"
160
- "Where are volunteers being requested?",
161
- "Where has road damage occured?",
162
- "What area has the wildfire burned?",
163
- "Where have homes been damaged or destroyed?"]
164
 
165
  selected_queries = gr.CheckboxGroup(label="Select at least one query using the checkboxes", interactive=True)
166
  qa_button = gr.Button("Start QA")
 
58
  return incorrect, correct, accuracy, data_df, gr.DownloadButton(label=f"Download CSV", value="output.csv", visible=True)
59
 
60
  def get_queries():
61
+ queries = [
62
+ "What areas are being evacuated?",
63
+ "What areas are predicted to be impacted?",
64
+ "What areas are without power?",
65
+ "What barriers are hindering response efforts?",
66
+ "What events have been canceled?",
67
+ "What preparations are being made?",
68
+ "What regions have announced a state of emergency?",
69
+ "What roads are blocked / closed?",
70
+ "What services have been closed?",
71
+ "What warnings are currently in effect?",
72
+ "Where are emergency services deployed?",
73
+ "Where are emergency services needed?",
74
+ "Where are evacuations needed?",
75
+ "Where are people needing rescued?",
76
+ "Where are recovery efforts taking place?",
77
+ "Where has building or infrastructure damage occurred?",
78
+ "Where has flooding occured?"
79
+ "Where are volunteers being requested?",
80
+ "Where has road damage occured?",
81
+ "What area has the wildfire burned?",
82
+ "Where have homes been damaged or destroyed?"]
83
+ return gr.CheckboxGroup(choices=queries)
84
 
85
  with gr.Blocks() as demo:
86
  event_models = ["jayebaku/distilbert-base-multilingual-cased-crexdata-relevance-classifier"]
 
157
  calculate_accuracy,
158
  inputs=[flood_checkbox_output, fire_checkbox_output, none_checkbox_output, num_posts, text_field, data],
159
  outputs=[incorrect, correct, accuracy, data_eval, download_csv])
160
+
161
+ qa_tab = gr.Tab("Question Answering")
162
+
163
+ qa_tab.select(get_queries, None, selected_queries)
164
+ with qa_tab:
165
  # XXX Add some button disabling here, if the classification process is not completed first XXX
166
 
167
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
169
  selected_queries = gr.CheckboxGroup(label="Select at least one query using the checkboxes", interactive=True)
170
  qa_button = gr.Button("Start QA")