jayebaku commited on
Commit
984f521
·
verified ·
1 Parent(s): 2097977

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -23
app.py CHANGED
@@ -62,33 +62,36 @@ def calculate_accuracy(flood_selections, fire_selections, none_selections, num_p
62
  return incorrect, correct, accuracy, data_df, gr.DownloadButton(label=f"Download CSV", value="output.csv", visible=True)
63
 
64
  def init_queries(history):
65
- history = [
66
- "What areas are being evacuated?",
67
- "What areas are predicted to be impacted?",
68
- "What areas are without power?",
69
- "What barriers are hindering response efforts?",
70
- "What events have been canceled?",
71
- "What preparations are being made?",
72
- "What regions have announced a state of emergency?",
73
- "What roads are blocked / closed?",
74
- "What services have been closed?",
75
- "What warnings are currently in effect?",
76
- "Where are emergency services deployed?",
77
- "Where are emergency services needed?",
78
- "Where are evacuations needed?",
79
- "Where are people needing rescued?",
80
- "Where are recovery efforts taking place?",
81
- "Where has building or infrastructure damage occurred?",
82
- "Where has flooding occured?"
83
- "Where are volunteers being requested?",
84
- "Where has road damage occured?",
85
- "What area has the wildfire burned?",
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:
 
62
  return incorrect, correct, accuracy, data_df, gr.DownloadButton(label=f"Download CSV", value="output.csv", visible=True)
63
 
64
  def init_queries(history):
65
+ history = history or []
66
+ if not history:
67
+ history = [
68
+ "What areas are being evacuated?",
69
+ "What areas are predicted to be impacted?",
70
+ "What areas are without power?",
71
+ "What barriers are hindering response efforts?",
72
+ "What events have been canceled?",
73
+ "What preparations are being made?",
74
+ "What regions have announced a state of emergency?",
75
+ "What roads are blocked / closed?",
76
+ "What services have been closed?",
77
+ "What warnings are currently in effect?",
78
+ "Where are emergency services deployed?",
79
+ "Where are emergency services needed?",
80
+ "Where are evacuations needed?",
81
+ "Where are people needing rescued?",
82
+ "Where are recovery efforts taking place?",
83
+ "Where has building or infrastructure damage occurred?",
84
+ "Where has flooding occured?"
85
+ "Where are volunteers being requested?",
86
+ "Where has road damage occured?",
87
+ "What area has the wildfire burned?",
88
+ "Where have homes been damaged or destroyed?"]
89
 
90
  return gr.CheckboxGroup(choices=history), history
91
 
92
  def add_query(to_add, history):
93
+ if to_add not in history:
94
+ history.append(to_add)
95
  return gr.CheckboxGroup(choices=history), history
96
 
97
  with gr.Blocks() as demo: