leahb commited on
Commit
3b3441d
·
verified ·
1 Parent(s): 0dd7f8e
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
2
  import random
3
  from huggingface_hub import InferenceClient
4
 
 
 
5
  def match_europe(scores):
6
  a = scores.count("A")
7
  b = scores.count("B")
@@ -30,7 +32,7 @@ def match_europe(scores):
30
  elif e > a and e > b and e > c and e > d:
31
  return "Barcelona, Spain"
32
  else:
33
- return "Rome"
34
  questions_europe = [
35
  ("1. What kind of people do you enjoy meeting?", [
36
  ("A", "Locals who know the city's deep history and culture."),
@@ -101,6 +103,17 @@ with gr.Blocks() as demo:
101
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
102
  # change the LLM
103
 
 
 
 
 
 
 
 
 
 
 
 
104
  def respond(message, history):
105
 
106
  messages = [{"role": "system", "content": "You are a chatbot that helps people plan their trips to make it easier for them. You usually try to give shorter responses unless the customer asks for an itinerary."}]
@@ -153,7 +166,7 @@ with gr.Blocks() as app:
153
  ]
154
  )
155
  send_button.click(
156
- respond,
157
  inputs = [location_input, age_range_input, length_input],
158
  outputs = [output_box]
159
 
 
2
  import random
3
  from huggingface_hub import InferenceClient
4
 
5
+ travel_plan_output=""
6
+
7
  def match_europe(scores):
8
  a = scores.count("A")
9
  b = scores.count("B")
 
32
  elif e > a and e > b and e > c and e > d:
33
  return "Barcelona, Spain"
34
  else:
35
+ return "Sydney, Australia"
36
  questions_europe = [
37
  ("1. What kind of people do you enjoy meeting?", [
38
  ("A", "Locals who know the city's deep history and culture."),
 
103
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
104
  # change the LLM
105
 
106
+ def respond_plan(location, age_range, length):
107
+ global travel_plan_output
108
+
109
+ prompt = f"""
110
+ **Travel Plan Details:**
111
+ - **To:** {location}
112
+ - **Travel Length:** {length}
113
+ - **Any Minors:** {age_range}
114
+
115
+ Provide a detailed travel guide based on these inputs.
116
+ """
117
  def respond(message, history):
118
 
119
  messages = [{"role": "system", "content": "You are a chatbot that helps people plan their trips to make it easier for them. You usually try to give shorter responses unless the customer asks for an itinerary."}]
 
166
  ]
167
  )
168
  send_button.click(
169
+ respond_plan,
170
  inputs = [location_input, age_range_input, length_input],
171
  outputs = [output_box]
172