dxvina-08 commited on
Commit
f26ce32
·
verified ·
1 Parent(s): d2c2cbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -94,6 +94,22 @@ def generate_response(user_query, relevant_segment):
94
  print(f"Error in generating response: {e}")
95
  return f"Error in generating response: {e}"
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  def query_model(question):
98
  """
99
  Process a question, find relevant information, and generate a response.
 
94
  print(f"Error in generating response: {e}")
95
  return f"Error in generating response: {e}"
96
 
97
+ def get_youtube_playlist(question):
98
+ """
99
+ Check if the question contains a keyword and return the corresponding Youtube playlist link.
100
+ """
101
+ keyword_links = {
102
+ "sad": "Here's a Youtube playlist for when you're feeling sad: https://www.youtube.com/playlist?list=PLPE5bssIbSTm3odLzXrlfCXnmpll8pqBu,
103
+ "hype": "Get hyped with this energetic Youtube playlist this upbeat Youtube playlist for when you're feeling happy: https://www.youtube.com/playlist?list=PLPE5bssIbSTnsN_-gd3-2sgHxm7i4CSSS,
104
+ "pressed":"Enjoy this energtic playlist when you are mad:https://www.youtube.com/playlist?list=PLPE5bssIbSTnwU9lG7jdnuqzoKUKFbUGb",
105
+ }
106
+
107
+ for keyword, link in keyword_links.items():
108
+ if keyword in question.lower():
109
+ return link
110
+
111
+ # If no keyword matches, return None or handle accordingly
112
+ return None
113
  def query_model(question):
114
  """
115
  Process a question, find relevant information, and generate a response.