JessicaL commited on
Commit
48ae76a
·
verified ·
1 Parent(s): 375a474

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -105,7 +105,30 @@ def query_model(question):
105
  return "Could not find specific information. Please refine your 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 ChessBot!
 
105
  return "Could not find specific information. Please refine your question."
106
  response = generate_response(question, relevant_segment)
107
  return response
108
+
109
+ def get_spotify_playlist(question):
110
+ """
111
+ Check if the question contains a keyword and return the corresponding Spotify playlist link.
112
+ """
113
+ keyword_links = {
114
+ "sad": "Here's a Spotify playlist for when you're feeling sad: put playlist link here",
115
+ "happy": "Enjoy this upbeat Spotify playlist for when you're feeling happy: put playlist link here",
116
+ "hyped": "Get hyped with this energetic Spotify playlist: put playlist link here"
117
+ }
118
+
119
+ for keyword, link in keyword_links.items():
120
+ if keyword in question.lower():
121
+ return link
122
+
123
+ def query_model(question):
124
+ """
125
+ Process a question, find relevant information, and generate a response.
126
+ """
127
+ spotify_playlist = get_spotify_playlist(question)
128
+ if spotify_playlist:
129
+ return f"Here is a link to a spotify song playlist based on how you are feeling! Just copy the link: {spotify_playlist}"
130
 
131
+
132
  # Define the welcome message and specific topics the chatbot can provide information about
133
  welcome_message = """
134
  # ♟️ Welcome to ChessBot!