Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
ee27340
1
Parent(s):
190a2ea
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def get_matches(text_query):
|
|
38 |
matches = compare_text_to_audio_embeddings(text_query, "audio_embeddings_v3.pkl")
|
39 |
|
40 |
# Format the output
|
41 |
-
output = f"<h2>Top 5 matches for '{text_query}</h2
|
42 |
|
43 |
for filename, url, similarity in matches[:3]:
|
44 |
output += f"{similarity:.4f}\n"
|
@@ -48,11 +48,13 @@ def get_matches(text_query):
|
|
48 |
# Extract video ID from the URL
|
49 |
video_id = url.split("v=")[-1] if "v=" in url else url.split("/")[-1]
|
50 |
print(f"https://www.youtube.com/embed/{video_id}")
|
|
|
51 |
# Create iframe for YouTube video
|
52 |
-
output += f'<
|
53 |
-
|
|
|
54 |
# Use regular link for non-YouTube URLs
|
55 |
-
|
56 |
|
57 |
return output
|
58 |
|
|
|
38 |
matches = compare_text_to_audio_embeddings(text_query, "audio_embeddings_v3.pkl")
|
39 |
|
40 |
# Format the output
|
41 |
+
output = f"<h2>Top 5 matches for '{text_query}'</h2>\n\n"
|
42 |
|
43 |
for filename, url, similarity in matches[:3]:
|
44 |
output += f"{similarity:.4f}\n"
|
|
|
48 |
# Extract video ID from the URL
|
49 |
video_id = url.split("v=")[-1] if "v=" in url else url.split("/")[-1]
|
50 |
print(f"https://www.youtube.com/embed/{video_id}")
|
51 |
+
song_name = filename.rsplit('.', 1)
|
52 |
# Create iframe for YouTube video
|
53 |
+
output += f'{song_name}: <a href="{url}">{url}</a>\n\n'
|
54 |
+
#output += f'<iframe width="560" height="315" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>\n\n'
|
55 |
+
#else:
|
56 |
# Use regular link for non-YouTube URLs
|
57 |
+
|
58 |
|
59 |
return output
|
60 |
|