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
|
15 |
# Initial system message to set the behavior of the assistant
|
16 |
messages = [{"role": "system", "content": system_message}]
|
17 |
|
@@ -67,7 +67,7 @@ def generate_response(user_query, relevant_segment):
|
|
67 |
Generate a response emphasizing the bot's capability in providing chess information.
|
68 |
"""
|
69 |
try:
|
70 |
-
user_message = f"Here
|
71 |
|
72 |
# Append user's message to messages list
|
73 |
messages.append({"role": "user", "content": user_message})
|
@@ -76,7 +76,7 @@ def generate_response(user_query, relevant_segment):
|
|
76 |
model="gpt-3.5-turbo",
|
77 |
messages=messages,
|
78 |
max_tokens=150,
|
79 |
-
temperature=0.
|
80 |
top_p=1,
|
81 |
frequency_penalty=0,
|
82 |
presence_penalty=0
|
@@ -99,29 +99,25 @@ 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
|
106 |
response = generate_response(question, relevant_segment)
|
107 |
return response
|
108 |
|
109 |
# Define the welcome message and specific topics the chatbot can provide information about
|
110 |
welcome_message = """
|
111 |
-
#
|
112 |
|
113 |
-
##
|
114 |
"""
|
115 |
|
116 |
topics = """
|
117 |
### Feel Free to ask me anything from the topics below!
|
118 |
-
-
|
119 |
-
-
|
120 |
-
-
|
121 |
-
- Common strategies
|
122 |
-
- Chess terminology
|
123 |
-
- Famous games
|
124 |
-
- Chess tactics
|
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 make outfits by taking keywords inputted by users and suggesting simple clothing pieces from eco friendly brands that work together to create a cohesive outfit. "
|
15 |
# Initial system message to set the behavior of the assistant
|
16 |
messages = [{"role": "system", "content": system_message}]
|
17 |
|
|
|
67 |
Generate a response emphasizing the bot's capability in providing chess information.
|
68 |
"""
|
69 |
try:
|
70 |
+
user_message = f"Of course! Here are your outfit suggestions and some sustainable brands you can buy from: {relevant_segment}"
|
71 |
|
72 |
# Append user's message to messages list
|
73 |
messages.append({"role": "user", "content": user_message})
|
|
|
76 |
model="gpt-3.5-turbo",
|
77 |
messages=messages,
|
78 |
max_tokens=150,
|
79 |
+
temperature=0.3,
|
80 |
top_p=1,
|
81 |
frequency_penalty=0,
|
82 |
presence_penalty=0
|
|
|
99 |
Process a question, find relevant information, and generate a response.
|
100 |
"""
|
101 |
if question == "":
|
102 |
+
return "Welcome to Savvy! Use the word bank to describe the outfit you would like generated."
|
103 |
relevant_segment = find_relevant_segment(question, segments)
|
104 |
if not relevant_segment:
|
105 |
+
return "I'm sorry. Could you be more specific? Check your spelling and make sure to use words from the bank."
|
106 |
response = generate_response(question, relevant_segment)
|
107 |
return response
|
108 |
|
109 |
# Define the welcome message and specific topics the chatbot can provide information about
|
110 |
welcome_message = """
|
111 |
+
# 🌷 Welcome to Savvy!
|
112 |
|
113 |
+
## You can ask our SustainaBot to find eco-friendly brands, make outfits based on season and aesthetic, and to learn more about the detriments of fast fashion. You can also learn how to contribute to circular fashion by scrolling down. Created by Sarah, Medha, Nicole, and Tegen of the 2024 Kode With Klossy CITY Camp.
|
114 |
"""
|
115 |
|
116 |
topics = """
|
117 |
### Feel Free to ask me anything from the topics below!
|
118 |
+
- Sustainable brands
|
119 |
+
- Outfit ideas
|
120 |
+
- Fast fashion statistics
|
|
|
|
|
|
|
|
|
121 |
"""
|
122 |
|
123 |
# Setup the Gradio Blocks interface with custom layout components
|