polinapred commited on
Commit
ab57d69
·
verified ·
1 Parent(s): a03fb8e

debugging

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -60,15 +60,15 @@ def respond(message, history):
60
  context = "\n- ".join(retrieved_info)
61
 
62
  system_prompt = f"""You are 'CityScout', a friendly guide to unique hangout spots.
63
- Use the following verified facts from our database to help the user:
 
 
 
64
  - {context}
 
65
  If you find a match, describe it enthusiastically! If not, help them brainstorm based on their interests."""
66
- #use the processed data in the role prompt
67
 
68
  messages = [{"role": "system", "content": system_prompt}]
69
- for user_msg, assistant_msg in history:
70
- if user_msg: messages.append({"role": "user", "content": user_msg})
71
- if assistant_msg: messages.append({"role": "assistant", "content": assistant_msg})
72
 
73
  for msg in history:
74
  messages.append(msg)
@@ -76,7 +76,6 @@ def respond(message, history):
76
  messages.append({"role": "user", "content": message})
77
 
78
  response = ""
79
-
80
  for chunk in client.chat_completion(
81
  messages,
82
  max_tokens=500,
@@ -89,9 +88,11 @@ def respond(message, history):
89
  response += token
90
  yield response
91
 
92
-
93
- chatbot = gr.ChatInterface(respond,
 
94
  title="CityScout: Unique Spot Finder",
95
- description="Tell me your city and interests to find a cool spot!")
 
96
 
97
  chatbot.launch()
 
60
  context = "\n- ".join(retrieved_info)
61
 
62
  system_prompt = f"""You are 'CityScout', a friendly guide to unique hangout spots.
63
+ Use the following verified facts from our database to help the user.
64
+ Always mention the name of the spot found in the brackets [Like This].
65
+
66
+ Database Facts:
67
  - {context}
68
+
69
  If you find a match, describe it enthusiastically! If not, help them brainstorm based on their interests."""
 
70
 
71
  messages = [{"role": "system", "content": system_prompt}]
 
 
 
72
 
73
  for msg in history:
74
  messages.append(msg)
 
76
  messages.append({"role": "user", "content": message})
77
 
78
  response = ""
 
79
  for chunk in client.chat_completion(
80
  messages,
81
  max_tokens=500,
 
88
  response += token
89
  yield response
90
 
91
+ chatbot = gr.ChatInterface(
92
+ respond,
93
+ type="messages",
94
  title="CityScout: Unique Spot Finder",
95
+ description="Tell me your city and interests to find a cool spot!"
96
+ )
97
 
98
  chatbot.launch()