Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -75,12 +75,63 @@ def generate_response(user_query, relevant_segment):
|
|
75 |
response = openai.ChatCompletion.create(
|
76 |
model="gpt-3.5-turbo",
|
77 |
messages=messages,
|
78 |
-
max_tokens=
|
79 |
temperature=0.2,
|
80 |
top_p=1,
|
81 |
frequency_penalty=0,
|
82 |
presence_penalty=0
|
83 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
# Extract the response text
|
86 |
output_text = response['choices'][0]['message']['content'].strip()
|
@@ -106,6 +157,7 @@ def query_model(question):
|
|
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 Mental Music Bot!
|
|
|
75 |
response = openai.ChatCompletion.create(
|
76 |
model="gpt-3.5-turbo",
|
77 |
messages=messages,
|
78 |
+
max_tokens=300,
|
79 |
temperature=0.2,
|
80 |
top_p=1,
|
81 |
frequency_penalty=0,
|
82 |
presence_penalty=0
|
83 |
)
|
84 |
+
def get_sad_link_playlist(question):
|
85 |
+
"""
|
86 |
+
Check if the question contains a keyword and return the corresponding Pinterest link.
|
87 |
+
"""
|
88 |
+
keyword_links = {
|
89 |
+
"sad": "Here is a link to the sad playlist based on your response. Copy the link that will direct you to the playlist: https://youtube.com/playlist?list=PLPE5bssIbSTm3odLzXrlfCXnmpll8pqBu&si=49rIb3IwueIzKGif",
|
90 |
+
}
|
91 |
+
|
92 |
+
def get_hype_link_playlist(question):
|
93 |
+
"""
|
94 |
+
Check if the question contains a keyword and return the corresponding Pinterest link.
|
95 |
+
"""
|
96 |
+
keyword_links = {
|
97 |
+
"hype": "Here is a link to the hype playlist based on your response. Copy the link that will direct you to the playlist: https://youtube.com/playlist?list=PLPE5bssIbSTnsN_-gd3-2sgHxm7i4CSSS&si=3pPHtcvyVCebTNL8",
|
98 |
+
}
|
99 |
+
|
100 |
+
def get_delulu_link_playlist(question):
|
101 |
+
"""
|
102 |
+
Check if the question contains a keyword and return the corresponding Pinterest link.
|
103 |
+
"""
|
104 |
+
keyword_links = {
|
105 |
+
"delulu": "Here is a link to the delulu playlist based on your response. Copy the link that will direct you to the playlist: https://youtube.com/playlist?list=PLPE5bssIbSTlfj8IbqgD2SRVh83Hs1TZG&si=9cZOZWqLbdFD58xW",
|
106 |
+
}
|
107 |
+
|
108 |
+
def get_pressed_link_playlist(question):
|
109 |
+
"""
|
110 |
+
Check if the question contains a keyword and return the corresponding Pinterest link.
|
111 |
+
"""
|
112 |
+
keyword_links = {
|
113 |
+
"pressed": "Here is a link to the pressed playlist based on your response. Copy the link that will direct you to the playlist: https://youtube.com/playlist?list=PLPE5bssIbSTnwU9lG7jdnuqzoKUKFbUGb&si=XKJnHt3yj1Us17OO",
|
114 |
+
}
|
115 |
+
|
116 |
+
def get_chill_link_playlist(question):
|
117 |
+
"""
|
118 |
+
Check if the question contains a keyword and return the corresponding Pinterest link.
|
119 |
+
"""
|
120 |
+
keyword_links = {
|
121 |
+
"chill": "Here is a link to the chill playlist based on your response. Copy the link that will direct you to the playlist: https://youtube.com/playlist?list=PLPE5bssIbSTkjkb4FfYcaI3tVtfE3IrAx&si=lzxZdnzB0CrnWbfS",
|
122 |
+
}
|
123 |
+
|
124 |
+
def get_itgirl_link_playlist(question):
|
125 |
+
"""
|
126 |
+
Check if the question contains a keyword and return the corresponding Pinterest link.
|
127 |
+
"""
|
128 |
+
keyword_links = {
|
129 |
+
"itgirl": "Here is a link to the chill playlist based on your response. Copy the link that will direct you to the playlist: https://youtube.com/playlist?list=PLPE5bssIbSTkjkb4FfYcaI3tVtfE3IrAx&si=lzxZdnzB0CrnWbfS",
|
130 |
+
}
|
131 |
+
|
132 |
+
for keyword, link in keyword_links.items():
|
133 |
+
if keyword in question.lower():
|
134 |
+
return link
|
135 |
|
136 |
# Extract the response text
|
137 |
output_text = response['choices'][0]['message']['content'].strip()
|
|
|
157 |
response = generate_response(question, relevant_segment)
|
158 |
return response
|
159 |
|
160 |
+
|
161 |
# Define the welcome message and specific topics the chatbot can provide information about
|
162 |
welcome_message = """
|
163 |
# 🎶 Welcome to Mental Music Bot!
|