bhavnapatur commited on
Commit
70af3e6
·
verified ·
1 Parent(s): 37479ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -74,13 +74,14 @@ questions_europe = [
74
  ]
75
 
76
  def create_quiz(questions, match_func):
77
- answers = []
78
- with gr.Column():
79
- for q, opts in questions:
80
- choices = [opt[1] for opt in opts]
81
- answers.append(gr.Radio(choices=choices, label=q))
82
- result = gr.Textbox(label="You should travel to...")
83
- btn = gr.Button("Find Ideal Location")
 
84
 
85
  def evaluate(*vals):
86
  codes = []
@@ -116,7 +117,7 @@ def parse_date(date_str):
116
  parsed_date = dateparser.parse(date_str, settings={'PREFER_DATES_FROM': 'future'})
117
  return parsed_date if parsed_date else None
118
 
119
- def respond(your_location, destination, transportation, date, preference, include_options):
120
  global travel_guide_output
121
  travel_date = parse_date(date)
122
 
@@ -127,6 +128,7 @@ def respond(your_location, destination, transportation, date, preference, includ
127
  - **Transportation:** {transportation}
128
  - **Travel Date:** {date}
129
  - **Budget Preference:** {preference}
 
130
  - **Additional Info:** {', '.join(include_options) if include_options else 'None'}
131
  Provide a detailed travel guide based on these details.
132
  """
@@ -177,8 +179,9 @@ with gr.Blocks(theme='shivi/calm_seafoam') as app:
177
  date_input = gr.Textbox(label="Travel Date (e.g., tomorrow, March 15)")
178
  preference_dropdown = gr.Dropdown(["Luxurious", "Cheap", "Balanced"], label="Budget Preferences")
179
  include_checkboxes = gr.CheckboxGroup([
180
- "Restaurant recommendations", "Hotel suggestions", "Nearby attractions", "Local tips", "Packing guides"
181
- ], label="Include in Chat")
 
182
  send_button = gr.Button("Generate Guide")
183
 
184
  with gr.Column(scale=2):
@@ -197,7 +200,7 @@ with gr.Blocks(theme='shivi/calm_seafoam') as app:
197
 
198
  send_button.click(
199
  respond,
200
- inputs=[your_location_input, destination_input, transportation_dropdown, date_input, preference_dropdown, include_checkboxes],
201
  outputs=[output_box]
202
  )
203
 
 
74
  ]
75
 
76
  def create_quiz(questions, match_func):
77
+ with gr.Blocks(css = "#rounded-btn {border-radius: 12px; padding: 10px 20px}")as demo:
78
+ answers = []
79
+ with gr.Column():
80
+ for q, opts in questions:
81
+ choices = [opt[1] for opt in opts]
82
+ answers.append(gr.Radio(choices=choices, label=q))
83
+ result = gr.Textbox(label="You should travel to...")
84
+ btn = gr.Button("Find Ideal Location", elem_id = "rounded-btn")
85
 
86
  def evaluate(*vals):
87
  codes = []
 
117
  parsed_date = dateparser.parse(date_str, settings={'PREFER_DATES_FROM': 'future'})
118
  return parsed_date if parsed_date else None
119
 
120
+ def respond(your_location, destination, transportation, date, preference, include_options, minors):
121
  global travel_guide_output
122
  travel_date = parse_date(date)
123
 
 
128
  - **Transportation:** {transportation}
129
  - **Travel Date:** {date}
130
  - **Budget Preference:** {preference}
131
+ - **Minors included:** {minors}
132
  - **Additional Info:** {', '.join(include_options) if include_options else 'None'}
133
  Provide a detailed travel guide based on these details.
134
  """
 
179
  date_input = gr.Textbox(label="Travel Date (e.g., tomorrow, March 15)")
180
  preference_dropdown = gr.Dropdown(["Luxurious", "Cheap", "Balanced"], label="Budget Preferences")
181
  include_checkboxes = gr.CheckboxGroup([
182
+ "Restaurant Nearby", "Hotels ", "Nearby attractions", "Local tips"], label="Include in Chat")
183
+ minors_included = gr.Dropdown(["Yes", "No"], label="Are there minors on the trip?")
184
+
185
  send_button = gr.Button("Generate Guide")
186
 
187
  with gr.Column(scale=2):
 
200
 
201
  send_button.click(
202
  respond,
203
+ inputs=[your_location_input, destination_input, transportation_dropdown, date_input, preference_dropdown, include_checkboxes, minors_included],
204
  outputs=[output_box]
205
  )
206