sjw commited on
Commit
e75e213
ยท
1 Parent(s): 86f343a

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +12 -5
  2. messages.py +12 -2
app.py CHANGED
@@ -29,7 +29,7 @@ from langchain.prompts import MessagesPlaceholder
29
  from langchain.schema import SystemMessage, HumanMessage
30
 
31
 
32
- from messages import SYSTEM_MESSAGE, GENRE_LIST, HTML, APOLLO_MESSAGE
33
  from dotenv import load_dotenv
34
  load_dotenv()
35
 
@@ -869,12 +869,12 @@ with gr.Blocks(theme=THEME) as app:
869
  def respond(user_message, chat_history, agent_executor):
870
  try:
871
  if user_message.strip() == "-music":
872
- bot_message = APOLLO_MESSAGE
873
  else:
874
  bot_message = agent_executor.run(user_message)
875
  chat_history.append((user_message, bot_message))
876
  except Exception as e:
877
- bot_message = "Error: Unable to **connect to your Spotify** | Please ensure you followed the above steps correctly"
878
  chat_history.append((user_message, bot_message))
879
  time.sleep(1)
880
  return "", chat_history
@@ -888,9 +888,16 @@ with gr.Blocks(theme=THEME) as app:
888
 
889
  gr.HTML('''
890
  <p class="hover-item" style="color: #CECECE; font-size: 13px; padding: 12px 0; text-align: left;">
891
- <a href="https://github.com/stuartwaller/Spotify-Chatbot" target="_blank">GitHub Repo</a> |
892
  I'd love to hear your feedback: stuart.j.waller@vanderbilt.edu
893
  </p>
894
  ''')
895
  app.launch()
896
- #app.launch(share=True)
 
 
 
 
 
 
 
 
29
  from langchain.schema import SystemMessage, HumanMessage
30
 
31
 
32
+ from messages import SYSTEM_MESSAGE, GENRE_LIST, HTML, COMMANDS_MSG, ERROR_MSG
33
  from dotenv import load_dotenv
34
  load_dotenv()
35
 
 
869
  def respond(user_message, chat_history, agent_executor):
870
  try:
871
  if user_message.strip() == "-music":
872
+ bot_message = COMMANDS_MSG
873
  else:
874
  bot_message = agent_executor.run(user_message)
875
  chat_history.append((user_message, bot_message))
876
  except Exception as e:
877
+ bot_message = ERROR_MSG
878
  chat_history.append((user_message, bot_message))
879
  time.sleep(1)
880
  return "", chat_history
 
888
 
889
  gr.HTML('''
890
  <p class="hover-item" style="color: #CECECE; font-size: 13px; padding: 12px 0; text-align: left;">
891
+ <a href="YOUR_SOURCE_CODE_URL" target="_blank">GitHub Repo</a> |
892
  I'd love to hear your feedback: stuart.j.waller@vanderbilt.edu
893
  </p>
894
  ''')
895
  app.launch()
896
+ #app.launch(share=True)
897
+
898
+
899
+
900
+
901
+
902
+
903
+
messages.py CHANGED
@@ -66,11 +66,15 @@ HTML = """
66
  right: 9%;
67
  transform: translateY(-50%);
68
  }
 
 
 
 
69
  </style>
70
  </head>
71
  <body>
72
  <div class="container" style="text-align: left; margin-top: 50px;">
73
- <h1 style="color: white; font-size: 56px;">Apollo<sup style="color: #E457E2;">AI</sup> Music Assistant</h1>
74
  <h2 style="color: #E457E2; font-size: 26px;">Experience personalized, intelligent music interaction like never before</h2>
75
  <ul style="list-style-type: none; padding: 12px 0; margin: 0;">
76
  <li class="hover-item" style="color: #CECECE; font-size: 26px; padding: 12px 0;"><span style="color: #5491FA;">1.</span> Ensure your Spotify client is open</li>
@@ -88,7 +92,7 @@ HTML = """
88
  """
89
 
90
 
91
- APOLLO_MESSAGE = """
92
  Welcome! Tell me your **mood** to help me select the best music for you
93
 
94
  ### <span style="color: #E457E2;"> ๐Ÿ’ฟ Standard ๐Ÿ’ฟ</span>
@@ -104,3 +108,9 @@ Welcome! Tell me your **mood** to help me select the best music for you
104
  - **Recommendations:** I love Drake and house, recommend songs
105
  - **Create Playlist:** Make a relaxing playlist of SZA-like songs
106
  """
 
 
 
 
 
 
 
66
  right: 9%;
67
  transform: translateY(-50%);
68
  }
69
+ .video-link {
70
+ font-size: 14px;
71
+ color: #CECECE;
72
+ }
73
  </style>
74
  </head>
75
  <body>
76
  <div class="container" style="text-align: left; margin-top: 50px;">
77
+ <h1 style="color: white; font-size: 56px;">Apollo<sup style="color: #E457E2;">AI</sup> Music Assistant <a class="video-link" href="https://www.youtube.com/watch?v=fwKukm3qjsk">Tutorial Video</a></h1>
78
  <h2 style="color: #E457E2; font-size: 26px;">Experience personalized, intelligent music interaction like never before</h2>
79
  <ul style="list-style-type: none; padding: 12px 0; margin: 0;">
80
  <li class="hover-item" style="color: #CECECE; font-size: 26px; padding: 12px 0;"><span style="color: #5491FA;">1.</span> Ensure your Spotify client is open</li>
 
92
  """
93
 
94
 
95
+ COMMANDS_MSG = """
96
  Welcome! Tell me your **mood** to help me select the best music for you
97
 
98
  ### <span style="color: #E457E2;"> ๐Ÿ’ฟ Standard ๐Ÿ’ฟ</span>
 
108
  - **Recommendations:** I love Drake and house, recommend songs
109
  - **Create Playlist:** Make a relaxing playlist of SZA-like songs
110
  """
111
+
112
+ ERROR_MSG = """
113
+ Error: Unable to **connect to your Spotify** | Please ensure you followed the above steps correctly
114
+
115
+ Need help? Watch this brief tutorial https://www.youtube.com/watch?v=fwKukm3qjsk&t=211s
116
+ """