Spaces:
Sleeping
Sleeping
test returning link
Browse files
app.py
CHANGED
@@ -57,7 +57,7 @@ def play_audio_from_url(url):
|
|
57 |
pygame.time.Clock().tick(10)
|
58 |
|
59 |
@tool
|
60 |
-
def play_preview_deezer(track: str, artist:str) ->
|
61 |
"""Play a preview of a track from Deezer.
|
62 |
Args:
|
63 |
track: The track to play.
|
@@ -88,11 +88,11 @@ def play_preview_deezer(track: str, artist:str) -> None:
|
|
88 |
print(f"link: {first_track['link']}")
|
89 |
# Play the track
|
90 |
print("Playing preview: ", first_track['preview'])
|
91 |
-
|
92 |
else:
|
93 |
-
|
94 |
else:
|
95 |
-
|
96 |
|
97 |
final_answer = FinalAnswerTool()
|
98 |
|
|
|
57 |
pygame.time.Clock().tick(10)
|
58 |
|
59 |
@tool
|
60 |
+
def play_preview_deezer(track: str, artist:str) -> str:
|
61 |
"""Play a preview of a track from Deezer.
|
62 |
Args:
|
63 |
track: The track to play.
|
|
|
88 |
print(f"link: {first_track['link']}")
|
89 |
# Play the track
|
90 |
print("Playing preview: ", first_track['preview'])
|
91 |
+
return first_track['preview']
|
92 |
else:
|
93 |
+
raise ValueError("No tracks found.")
|
94 |
else:
|
95 |
+
raise ValueError(f"Error: {response.status_code}")
|
96 |
|
97 |
final_answer = FinalAnswerTool()
|
98 |
|