Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- .gitattributes +1 -0
- apollog.gif +3 -0
- app.py +20 -26
- avatar2.png +0 -0
.gitattributes
CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
apollo.gif filter=lfs diff=lfs merge=lfs -text
|
|
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
apollo.gif filter=lfs diff=lfs merge=lfs -text
|
37 |
+
apollog.gif filter=lfs diff=lfs merge=lfs -text
|
apollog.gif
ADDED
Git LFS Details
|
app.py
CHANGED
@@ -48,19 +48,20 @@ def debug_print(*args, **kwargs):
|
|
48 |
print(*args, **kwargs)
|
49 |
|
50 |
THEME = gr.themes.Default(
|
51 |
-
primary_hue=gr.themes.colors.
|
52 |
-
font=[gr.themes.GoogleFont("
|
53 |
spacing_size=gr.themes.sizes.spacing_sm,
|
54 |
radius_size=gr.themes.sizes.radius_sm,
|
55 |
text_size=gr.themes.sizes.text_lg
|
56 |
).set(
|
57 |
-
body_background_fill="#
|
58 |
#button_primary_background_fill="white",
|
59 |
#button_primary_text_color="black",
|
60 |
-
button_primary_background_fill_hover="
|
61 |
#button_primary_text_color_hover="white"
|
62 |
-
|
63 |
)
|
|
|
|
|
64 |
|
65 |
# TODO: switch to personal website
|
66 |
REDIRECT_URI = "https://jonaswaller.com"
|
@@ -141,15 +142,15 @@ with gr.Blocks(theme=THEME) as app:
|
|
141 |
access_token = parse_qs(fragment)['access_token'][0]
|
142 |
debug_print(access_token)
|
143 |
|
144 |
-
return access_token, '<p class="hover-item" style="color: #
|
145 |
|
146 |
else:
|
147 |
auth_url = (
|
148 |
f"https://accounts.spotify.com/authorize?response_type=token&client_id={client_id}"
|
149 |
f"&scope={'%20'.join(SCOPE)}&redirect_uri={REDIRECT_URI}"
|
150 |
)
|
151 |
-
return f'<p class="hover-item" style="color: #
|
152 |
-
f'<span style="color: #
|
153 |
f'style="color: inherit !important; text-decoration: none !important;" ' \
|
154 |
f'onmouseover="this.style.fontSize=\'105%\';" onmouseout="this.style.fontSize=\'100%\';">' \
|
155 |
f'here</a> and copy the entire URL</p>'
|
@@ -366,7 +367,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
366 |
]
|
367 |
ai_response = llm(messages).content
|
368 |
summary = f"""
|
369 |
-
**Name:** <span style="color: #
|
370 |
**Artist:** {basic_info["artist_name"]}
|
371 |
**Album:** {basic_info["album_name"]}
|
372 |
**Release:** {basic_info["release_date"]}
|
@@ -381,7 +382,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
381 |
else: # if no Genius page exists
|
382 |
url = "https://genius.com/Genius-how-to-add-songs-to-genius-annotated"
|
383 |
summary = f"""
|
384 |
-
**Name:** <span style="color: #
|
385 |
**Artist:** {basic_info["artist_name"]}
|
386 |
**Album:** {basic_info["album_name"]}
|
387 |
**Release:** {basic_info["release_date"]}
|
@@ -497,7 +498,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
497 |
sp.start_playback(device_id=device_id, uris=track_uris)
|
498 |
|
499 |
return f"""
|
500 |
-
**♫ Now Playing:** <span style="color: #
|
501 |
|
502 |
**Selected Tracks:**\n
|
503 |
{track_list_str}
|
@@ -553,7 +554,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
553 |
sp.start_playback(device_id=device_id, uris=track_uris)
|
554 |
|
555 |
return f"""
|
556 |
-
**♫ Now Playing:** <span style="color: #
|
557 |
|
558 |
**Selected Tracks:**\n
|
559 |
{track_list_str}
|
@@ -617,7 +618,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
617 |
sp.start_playback(device_id=device_id, uris=track_uris)
|
618 |
|
619 |
return f"""
|
620 |
-
**♫ Now Playing Recommendations Based On:** <span style="color: #
|
621 |
{', '.join(filter(None, [genre_name, artist_name, track_name, "Your Mood"]))}</span> ���
|
622 |
|
623 |
**Selected Tracks:**\n
|
@@ -654,7 +655,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
654 |
playlist_url = f"https://open.spotify.com/playlist/{new_playlist['id']}"
|
655 |
|
656 |
return f"""
|
657 |
-
♫ Created *{playlist_name}* Based On: <span style='color: #
|
658 |
{', '.join(filter(None, [genre_name, artist_name, track_name, 'Your Mood']))}</span> ♫
|
659 |
|
660 |
**Selected Tracks:**\n
|
@@ -844,7 +845,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
844 |
agent = OpenAIFunctionsAgent(llm=llm, tools=CUSTOM_TOOLS, prompt=prompt)
|
845 |
agent_executor = AgentExecutor(agent=agent, tools=CUSTOM_TOOLS, memory=memory, verbose=True)
|
846 |
|
847 |
-
return agent_executor, '<p class="hover-item" style="color: #
|
848 |
|
849 |
create_agent_button.click(create_agent, inputs=[ACCESS_TOKEN_VAR], outputs=[AGENT_EXECUTOR_VAR, create_agent_result])
|
850 |
|
@@ -858,7 +859,7 @@ with gr.Blocks(theme=THEME) as app:
|
|
858 |
bubble_full_width=False,
|
859 |
label="Apollo",
|
860 |
height=460,
|
861 |
-
avatar_images=(None, (os.path.join(os.path.dirname(__file__), "
|
862 |
)
|
863 |
msg = gr.Textbox(
|
864 |
placeholder="What would you like to hear?",
|
@@ -887,17 +888,10 @@ with gr.Blocks(theme=THEME) as app:
|
|
887 |
inputs=[msg], label="Quick Start 🚀")
|
888 |
|
889 |
gr.HTML('''
|
890 |
-
<p class="hover-item" style="color: #
|
891 |
-
<a href="
|
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 |
-
|
|
|
48 |
print(*args, **kwargs)
|
49 |
|
50 |
THEME = gr.themes.Default(
|
51 |
+
primary_hue=gr.themes.colors.stone,
|
52 |
+
font=[gr.themes.GoogleFont("Days One"), "monospace", "sans-serif"],
|
53 |
spacing_size=gr.themes.sizes.spacing_sm,
|
54 |
radius_size=gr.themes.sizes.radius_sm,
|
55 |
text_size=gr.themes.sizes.text_lg
|
56 |
).set(
|
57 |
+
body_background_fill="#FFFFFF",
|
58 |
#button_primary_background_fill="white",
|
59 |
#button_primary_text_color="black",
|
60 |
+
#button_primary_background_fill_hover="#DC143C",
|
61 |
#button_primary_text_color_hover="white"
|
|
|
62 |
)
|
63 |
+
# Days One | RocknRoll One
|
64 |
+
|
65 |
|
66 |
# TODO: switch to personal website
|
67 |
REDIRECT_URI = "https://jonaswaller.com"
|
|
|
142 |
access_token = parse_qs(fragment)['access_token'][0]
|
143 |
debug_print(access_token)
|
144 |
|
145 |
+
return access_token, '<p class="hover-item" style="color: #808080; font-size: 26px; padding: 12px 0; text-align: left;">Your Spotify is connected!</p>'
|
146 |
|
147 |
else:
|
148 |
auth_url = (
|
149 |
f"https://accounts.spotify.com/authorize?response_type=token&client_id={client_id}"
|
150 |
f"&scope={'%20'.join(SCOPE)}&redirect_uri={REDIRECT_URI}"
|
151 |
)
|
152 |
+
return f'<p class="hover-item" style="color: #808080; font-size: 26px; padding: 12px 0;">' \
|
153 |
+
f'<span style="color: #AC83F3;">8.</span> Click <a href="{auth_url}" target="_blank" ' \
|
154 |
f'style="color: inherit !important; text-decoration: none !important;" ' \
|
155 |
f'onmouseover="this.style.fontSize=\'105%\';" onmouseout="this.style.fontSize=\'100%\';">' \
|
156 |
f'here</a> and copy the entire URL</p>'
|
|
|
367 |
]
|
368 |
ai_response = llm(messages).content
|
369 |
summary = f"""
|
370 |
+
**Name:** <span style="color: #AC83F3; font-weight: bold; font-style: italic;">{basic_info["track_name"]}</span>
|
371 |
**Artist:** {basic_info["artist_name"]}
|
372 |
**Album:** {basic_info["album_name"]}
|
373 |
**Release:** {basic_info["release_date"]}
|
|
|
382 |
else: # if no Genius page exists
|
383 |
url = "https://genius.com/Genius-how-to-add-songs-to-genius-annotated"
|
384 |
summary = f"""
|
385 |
+
**Name:** <span style="color: #AC83F3; font-weight: bold; font-style: italic;">{basic_info["track_name"]}</span>
|
386 |
**Artist:** {basic_info["artist_name"]}
|
387 |
**Album:** {basic_info["album_name"]}
|
388 |
**Release:** {basic_info["release_date"]}
|
|
|
498 |
sp.start_playback(device_id=device_id, uris=track_uris)
|
499 |
|
500 |
return f"""
|
501 |
+
**♫ Now Playing:** <span style="color: #AC83F3; font-weight: bold; font-style: italic;">{genre_name}</span> ♫
|
502 |
|
503 |
**Selected Tracks:**\n
|
504 |
{track_list_str}
|
|
|
554 |
sp.start_playback(device_id=device_id, uris=track_uris)
|
555 |
|
556 |
return f"""
|
557 |
+
**♫ Now Playing:** <span style="color: #AC83F3; font-weight: bold; font-style: italic;">{artist_name}</span> ♫
|
558 |
|
559 |
**Selected Tracks:**\n
|
560 |
{track_list_str}
|
|
|
618 |
sp.start_playback(device_id=device_id, uris=track_uris)
|
619 |
|
620 |
return f"""
|
621 |
+
**♫ Now Playing Recommendations Based On:** <span style="color: #AC83F3; font-weight: bold; font-style: italic;">
|
622 |
{', '.join(filter(None, [genre_name, artist_name, track_name, "Your Mood"]))}</span> ���
|
623 |
|
624 |
**Selected Tracks:**\n
|
|
|
655 |
playlist_url = f"https://open.spotify.com/playlist/{new_playlist['id']}"
|
656 |
|
657 |
return f"""
|
658 |
+
♫ Created *{playlist_name}* Based On: <span style='color: #AC83F3; font-weight: bold; font-style: italic;'>
|
659 |
{', '.join(filter(None, [genre_name, artist_name, track_name, 'Your Mood']))}</span> ♫
|
660 |
|
661 |
**Selected Tracks:**\n
|
|
|
845 |
agent = OpenAIFunctionsAgent(llm=llm, tools=CUSTOM_TOOLS, prompt=prompt)
|
846 |
agent_executor = AgentExecutor(agent=agent, tools=CUSTOM_TOOLS, memory=memory, verbose=True)
|
847 |
|
848 |
+
return agent_executor, '<p class="hover-item" style="color: #808080; font-size: 26px; padding: 12px 0; text-align: left;">Success! Type -music to view commands</p>'
|
849 |
|
850 |
create_agent_button.click(create_agent, inputs=[ACCESS_TOKEN_VAR], outputs=[AGENT_EXECUTOR_VAR, create_agent_result])
|
851 |
|
|
|
859 |
bubble_full_width=False,
|
860 |
label="Apollo",
|
861 |
height=460,
|
862 |
+
avatar_images=(None, (os.path.join(os.path.dirname(__file__), "avatar2.png")))
|
863 |
)
|
864 |
msg = gr.Textbox(
|
865 |
placeholder="What would you like to hear?",
|
|
|
888 |
inputs=[msg], label="Quick Start 🚀")
|
889 |
|
890 |
gr.HTML('''
|
891 |
+
<p class="hover-item" style="color: #808080; font-size: 13px; padding: 12px 0; text-align: left;">
|
892 |
+
<a href="https://github.com/stuartwaller/Spotify-Chatbot" target="_blank">GitHub Repo</a> |
|
893 |
I'd love to hear your feedback: stuart.j.waller@vanderbilt.edu
|
894 |
</p>
|
895 |
''')
|
896 |
app.launch()
|
897 |
+
#app.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
avatar2.png
ADDED