Amitabhab commited on
Commit
c865d7c
·
1 Parent(s): 5b1b05f

Changing arrival date input to strig as HF seems to have a bug with datetime

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -76,7 +76,7 @@ def filter_map(text_list: List[str], lat: List[str], lon: List[str]) -> go.Figur
76
  def run(
77
  origin: str,
78
  destination: str,
79
- arrival_date: int,
80
  age: int,
81
  trip_duration: int,
82
  interests: List[str],
@@ -100,10 +100,17 @@ def run(
100
  Returns:
101
  Returns a tuple containing the itinerary and map
102
  """
 
 
 
 
103
  if arrival_date:
104
  arrival_date_input = datetime.datetime.fromtimestamp(arrival_date).strftime("%m-%d-%Y")
105
  else:
106
  arrival_date_input = None
 
 
 
107
  log_query(origin, destination, age, trip_duration, budget)
108
  logger.info(
109
  f'Origin: {origin}, Destination: {destination}, Arrival Date: {arrival_date_input},'
@@ -175,9 +182,20 @@ with gr.Blocks() as demo:
175
  with gr.Column(scale=1):
176
  inp_source = gr.Textbox(label='Where are you travelling from?')
177
  inp_dest = gr.Textbox(label='Where are you going?')
178
- inp_cal = gr.DateTime(label='Approximate arrival date')
179
  inp_age = gr.Slider(label='Your age?', value=30, minimum=15, maximum=90, step=5)
180
  inp_days = gr.Slider(label='How many days are you travelling?', value=5, minimum=1, maximum=14, step=1)
 
 
 
 
 
 
 
 
 
 
 
181
  inp_cuisine =\
182
  gr.CheckboxGroup(
183
  [
@@ -201,7 +219,7 @@ with gr.Blocks() as demo:
201
  label='Total budget of trip in USD', show_label=True, value=1000, minimum=500, maximum=10000, step=500
202
  )
203
  button = gr.Button("Plan your Trip")
204
- inputs = [inp_source, inp_dest, inp_cal, inp_age, inp_days, inp_cuisine, inp_children, inp_budget]
205
 
206
  with gr.Column(scale=2):
207
  output_itinerary =\
 
76
  def run(
77
  origin: str,
78
  destination: str,
79
+ arrival_date: str,
80
  age: int,
81
  trip_duration: int,
82
  interests: List[str],
 
100
  Returns:
101
  Returns a tuple containing the itinerary and map
102
  """
103
+ # Gradio Datetime is currently not working on HF
104
+ # See https://github.com/gradio-app/gradio/issues/10358
105
+ # Hece disabling datetime input and reverting back to string input
106
+ """
107
  if arrival_date:
108
  arrival_date_input = datetime.datetime.fromtimestamp(arrival_date).strftime("%m-%d-%Y")
109
  else:
110
  arrival_date_input = None
111
+ """
112
+ if arrival_date:
113
+ arrival_date_input = arrival_date.strip()
114
  log_query(origin, destination, age, trip_duration, budget)
115
  logger.info(
116
  f'Origin: {origin}, Destination: {destination}, Arrival Date: {arrival_date_input},'
 
182
  with gr.Column(scale=1):
183
  inp_source = gr.Textbox(label='Where are you travelling from?')
184
  inp_dest = gr.Textbox(label='Where are you going?')
185
+ inp_cal = gr.Textbox(label='Approximate arrival date in mm-dd-yyyy')
186
  inp_age = gr.Slider(label='Your age?', value=30, minimum=15, maximum=90, step=5)
187
  inp_days = gr.Slider(label='How many days are you travelling?', value=5, minimum=1, maximum=14, step=1)
188
+ inp_interests =\
189
+ gr.CheckboxGroup(
190
+ [
191
+ 'Museums',
192
+ 'Outdoor Adventures',
193
+ 'Shopping',
194
+ 'Off the beat activities',
195
+ 'Night Life',
196
+ ],
197
+ label='Checkbox your interests.',
198
+ )
199
  inp_cuisine =\
200
  gr.CheckboxGroup(
201
  [
 
219
  label='Total budget of trip in USD', show_label=True, value=1000, minimum=500, maximum=10000, step=500
220
  )
221
  button = gr.Button("Plan your Trip")
222
+ inputs = [inp_source, inp_dest, inp_cal, inp_age, inp_days, inp_interests, inp_cuisine, inp_children, inp_budget]
223
 
224
  with gr.Column(scale=2):
225
  output_itinerary =\