Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -236,8 +236,11 @@ def get_dataframe_of(day):
|
|
236 |
def get_specific_flights(day, max_delay, departure_hour, ampm, weather, destinations, yes):
|
237 |
df = get_dataframe_of(day)
|
238 |
|
|
|
|
|
|
|
239 |
# Remove unwanted destinations
|
240 |
-
destinations = [dest for dest in destinations if dest not in ["That's a reason why I travel alone...", "I prefer not to say"]]
|
241 |
|
242 |
# Select only flight during the same departure hour
|
243 |
df['departure_hour'] = df['ontime'].str.split(':').str[0].astype(int)
|
@@ -276,7 +279,7 @@ specific_flights = gr.Interface(
|
|
276 |
gr.Number(precision=0, minimum=0, maximum=23, label="Departure Time"),
|
277 |
gr.Radio(["am", "pm"], type="index", info="It's the same, no worries!", label = "Am or Pm?"),
|
278 |
gr.CheckboxGroup(["Yes, it's cloudy", "I am not in Stockholm"], label="Weather", info="Is it a typical Stockholm day?"),
|
279 |
-
gr.Dropdown(get_possible_destinations() + ["That's a reason why I travel alone...", "I prefer not to say"],
|
280 |
type = "value", multiselect=True, label="Destination", value=["That's a reason why I travel alone..."],
|
281 |
info="Are you just curious or you are actually going somewhere? Where? With who?"),
|
282 |
gr.Radio(["Yes", "Yes", "Yes"], type="index", label="Let's guess?", info="We know that you'll say yes!"),
|
|
|
236 |
def get_specific_flights(day, max_delay, departure_hour, ampm, weather, destinations, yes):
|
237 |
df = get_dataframe_of(day)
|
238 |
|
239 |
+
if ('Select all' in destinations):
|
240 |
+
destinations = def get_possible_destinations()
|
241 |
+
|
242 |
# Remove unwanted destinations
|
243 |
+
destinations = [dest for dest in destinations if dest not in ["That's a reason why I travel alone...", "I prefer not to say", 'Select all']]
|
244 |
|
245 |
# Select only flight during the same departure hour
|
246 |
df['departure_hour'] = df['ontime'].str.split(':').str[0].astype(int)
|
|
|
279 |
gr.Number(precision=0, minimum=0, maximum=23, label="Departure Time"),
|
280 |
gr.Radio(["am", "pm"], type="index", info="It's the same, no worries!", label = "Am or Pm?"),
|
281 |
gr.CheckboxGroup(["Yes, it's cloudy", "I am not in Stockholm"], label="Weather", info="Is it a typical Stockholm day?"),
|
282 |
+
gr.Dropdown(get_possible_destinations() + ["That's a reason why I travel alone...", "I prefer not to say", "Select all"],
|
283 |
type = "value", multiselect=True, label="Destination", value=["That's a reason why I travel alone..."],
|
284 |
info="Are you just curious or you are actually going somewhere? Where? With who?"),
|
285 |
gr.Radio(["Yes", "Yes", "Yes"], type="index", label="Let's guess?", info="We know that you'll say yes!"),
|