SebastianoMeneghin commited on
Commit
f51d548
·
verified ·
1 Parent(s): 613db98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -7,7 +7,7 @@ import os
7
  def download_data(path):
8
  os.path.abspath(path)
9
  df = pd.read_csv(path)
10
- wanted_df = df.drop_duplicates()
11
  return wanted_df
12
 
13
  def access_online_dataframe():
@@ -60,6 +60,16 @@ def get_specific_flights(day, max_delay, departure_hour, ampm, weather, destinat
60
 
61
  return filtered_df
62
 
 
 
 
 
 
 
 
 
 
 
63
 
64
 
65
  flights = gr.Interface(
@@ -68,7 +78,7 @@ flights = gr.Interface(
68
  gr.Radio(["today", "tomorrow"], type="value", label="Day", info="When do you have the plane?"),
69
  gr.Slider(0, 50, value=20, label="Possible Delay", info="How unfortunate do you wanna be?"),
70
  gr.Number(precision=0, minimum=0, maximum=23, label="Departure Time"),
71
- gr.Radio(["am", "pm"], type="index", info="It's the same, no worries!"),
72
  gr.CheckboxGroup(["Yes, it's cloudy", "I am not in Stockholm"], label="Weather", info="Is it a typical Stockholm day?"),
73
  gr.Dropdown(get_possible_destinations() + ["That's a reason why I travel alone...", "I prefer not to say"],
74
  type = "value", multiselect=True, label="Destination", value=["That's a reason why I travel alone..."],
@@ -78,4 +88,15 @@ flights = gr.Interface(
78
  "dataframe",
79
  )
80
 
81
- flights.launch()
 
 
 
 
 
 
 
 
 
 
 
 
7
  def download_data(path):
8
  os.path.abspath(path)
9
  df = pd.read_csv(path)
10
+ wanted_df = df[['airport', 'flight_number', 'ontime', 'delayed']].copy()
11
  return wanted_df
12
 
13
  def access_online_dataframe():
 
60
 
61
  return filtered_df
62
 
63
+ def full_day_departure(day):
64
+ today_df, tomorrow_df = access_online_dataframe()
65
+ df = pd.DataFrame()
66
+ if(day == 'today'):
67
+ df = today_df
68
+ else:
69
+ df = tomorrow_df
70
+
71
+ return df
72
+
73
 
74
 
75
  flights = gr.Interface(
 
78
  gr.Radio(["today", "tomorrow"], type="value", label="Day", info="When do you have the plane?"),
79
  gr.Slider(0, 50, value=20, label="Possible Delay", info="How unfortunate do you wanna be?"),
80
  gr.Number(precision=0, minimum=0, maximum=23, label="Departure Time"),
81
+ gr.Radio(["am", "pm"], type="index", info="It's the same, no worries!", label = "Am or Pm?"),
82
  gr.CheckboxGroup(["Yes, it's cloudy", "I am not in Stockholm"], label="Weather", info="Is it a typical Stockholm day?"),
83
  gr.Dropdown(get_possible_destinations() + ["That's a reason why I travel alone...", "I prefer not to say"],
84
  type = "value", multiselect=True, label="Destination", value=["That's a reason why I travel alone..."],
 
88
  "dataframe",
89
  )
90
 
91
+ total_departure = gr.Interface(
92
+ full_day_departure,
93
+ [
94
+ gr.Radio(["Today", "Tomorrow"], type="value", label="Departure", info="When are you departing?"),
95
+ ],
96
+ "dataframe",
97
+ )
98
+
99
+ #flights.launch()
100
+
101
+ interface = gr.TabbedInterface([flights, total_departure], ["Specific Flights", "Full Day Departure"])
102
+ interface.launch()