Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ retrieval_model_name = 'output/sentence-transformer-finetuned/'
|
|
| 11 |
|
| 12 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 13 |
|
| 14 |
-
system_message = "You are a
|
| 15 |
# Initial system message to set the behavior of the assistant
|
| 16 |
messages = [{"role": "system", "content": system_message}]
|
| 17 |
|
|
@@ -64,10 +64,10 @@ def find_relevant_segment(user_query, segments):
|
|
| 64 |
|
| 65 |
def generate_response(user_query, relevant_segment):
|
| 66 |
"""
|
| 67 |
-
Generate a response emphasizing the bot's capability in providing
|
| 68 |
"""
|
| 69 |
try:
|
| 70 |
-
user_message = f"Here's the information on
|
| 71 |
|
| 72 |
# Append user's message to messages list
|
| 73 |
messages.append({"role": "user", "content": user_message})
|
|
@@ -99,7 +99,7 @@ def query_model(question):
|
|
| 99 |
Process a question, find relevant information, and generate a response.
|
| 100 |
"""
|
| 101 |
if question == "":
|
| 102 |
-
return "Welcome to
|
| 103 |
relevant_segment = find_relevant_segment(question, segments)
|
| 104 |
if not relevant_segment:
|
| 105 |
return "Could not find specific information. Please refine your question."
|
|
@@ -108,20 +108,21 @@ def query_model(question):
|
|
| 108 |
|
| 109 |
# Define the welcome message and specific topics the chatbot can provide information about
|
| 110 |
welcome_message = """
|
| 111 |
-
# ♟️ Welcome to
|
| 112 |
|
| 113 |
-
## Your AI-driven assistant for all
|
| 114 |
"""
|
| 115 |
|
| 116 |
topics = """
|
| 117 |
-
### Feel
|
| 118 |
-
-
|
| 119 |
-
-
|
| 120 |
-
-
|
| 121 |
-
-
|
| 122 |
-
-
|
| 123 |
-
-
|
| 124 |
-
-
|
|
|
|
| 125 |
"""
|
| 126 |
|
| 127 |
# Setup the Gradio Blocks interface with custom layout components
|
|
|
|
| 11 |
|
| 12 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 13 |
|
| 14 |
+
system_message = "You are a eco-friendly travel chatbot specialized in providing information on eco-friendly restaurants, hotels, and attractions in NYC."
|
| 15 |
# Initial system message to set the behavior of the assistant
|
| 16 |
messages = [{"role": "system", "content": system_message}]
|
| 17 |
|
|
|
|
| 64 |
|
| 65 |
def generate_response(user_query, relevant_segment):
|
| 66 |
"""
|
| 67 |
+
Generate a response emphasizing the bot's capability in providing eco-friendly travel information.
|
| 68 |
"""
|
| 69 |
try:
|
| 70 |
+
user_message = f"Here's the information on eco-friendly travel information: {relevant_segment}"
|
| 71 |
|
| 72 |
# Append user's message to messages list
|
| 73 |
messages.append({"role": "user", "content": user_message})
|
|
|
|
| 99 |
Process a question, find relevant information, and generate a response.
|
| 100 |
"""
|
| 101 |
if question == "":
|
| 102 |
+
return "Welcome to GreenGuide! Ask me anything about eco-friendly hotels, restaurants, and things to do in NYC."
|
| 103 |
relevant_segment = find_relevant_segment(question, segments)
|
| 104 |
if not relevant_segment:
|
| 105 |
return "Could not find specific information. Please refine your question."
|
|
|
|
| 108 |
|
| 109 |
# Define the welcome message and specific topics the chatbot can provide information about
|
| 110 |
welcome_message = """
|
| 111 |
+
# ♟️ Welcome to GreenGuide!
|
| 112 |
|
| 113 |
+
## Your AI-driven assistant for all eco-friendly travel-related queries in NYC. Created by Eva, Amy, and Ambur of the 2024 Kode With Klossy NYC AI/ML Camp.
|
| 114 |
"""
|
| 115 |
|
| 116 |
topics = """
|
| 117 |
+
### Feel free to ask me anything from the neighborhoods below!
|
| 118 |
+
- Harlem
|
| 119 |
+
- Upper West Side
|
| 120 |
+
- Upper East Side
|
| 121 |
+
- Midtown
|
| 122 |
+
- Greenwich Village
|
| 123 |
+
- Little Italy
|
| 124 |
+
- Chinatown
|
| 125 |
+
- Financial District
|
| 126 |
"""
|
| 127 |
|
| 128 |
# Setup the Gradio Blocks interface with custom layout components
|