Spaces:
Runtime error
Runtime error
Commit
•
ab08646
1
Parent(s):
f952d3e
Upload app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ description = """
|
|
10 |
<a style='display:inline-block' href='https://ai-muzic.github.io/clamp/'><img src='https://img.shields.io/badge/website-CLaMP-ff69b4.svg' /></a>
|
11 |
<a style="display:inline-block" href="https://huggingface.co/datasets/sander-wood/wikimusictext"><img src="https://img.shields.io/badge/huggingface-dataset-ffcc66.svg"></a>
|
12 |
<a style="display:inline-block" href="https://arxiv.org/pdf/2304.11029.pdf"><img src="https://img.shields.io/badge/arXiv-2304.11029-b31b1b.svg"></a>
|
13 |
-
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/sander-wood/clamp_semantic_music_search?duplicate=true"><img style="margin-top:0;margin-bottom:0" src="https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-md-dark.svg" alt="Duplicate Space"></a>
|
14 |
</div>
|
15 |
|
16 |
## ℹ️ How to use this demo?
|
@@ -150,7 +149,7 @@ def semantic_music_search(query):
|
|
150 |
"""
|
151 |
with open(KEY_MODAL+"_key_cache_"+str(music_length)+".pth", 'rb') as f:
|
152 |
key_cache = torch.load(f)
|
153 |
-
|
154 |
# encode query
|
155 |
query_ids = encoding_data([unidecode(query)], QUERY_MODAL)
|
156 |
query_feature = get_features(query_ids, QUERY_MODAL)
|
@@ -173,6 +172,11 @@ def semantic_music_search(query):
|
|
173 |
# output += "Genre:\n" + item['genre']+ '\n\n'
|
174 |
# output += "Description:\n" + item['text']+ '\n\n'
|
175 |
# output += "ABC notation:\n" + item['music']+ '\n\n'
|
|
|
|
|
|
|
|
|
|
|
176 |
return item["title"], item["artist"], item["genre"], item["text"], item["music"]
|
177 |
|
178 |
output_title = gr.outputs.Textbox(label="Title")
|
|
|
10 |
<a style='display:inline-block' href='https://ai-muzic.github.io/clamp/'><img src='https://img.shields.io/badge/website-CLaMP-ff69b4.svg' /></a>
|
11 |
<a style="display:inline-block" href="https://huggingface.co/datasets/sander-wood/wikimusictext"><img src="https://img.shields.io/badge/huggingface-dataset-ffcc66.svg"></a>
|
12 |
<a style="display:inline-block" href="https://arxiv.org/pdf/2304.11029.pdf"><img src="https://img.shields.io/badge/arXiv-2304.11029-b31b1b.svg"></a>
|
|
|
13 |
</div>
|
14 |
|
15 |
## ℹ️ How to use this demo?
|
|
|
149 |
"""
|
150 |
with open(KEY_MODAL+"_key_cache_"+str(music_length)+".pth", 'rb') as f:
|
151 |
key_cache = torch.load(f)
|
152 |
+
print("\nQuery: "+query+"\n")
|
153 |
# encode query
|
154 |
query_ids = encoding_data([unidecode(query)], QUERY_MODAL)
|
155 |
query_feature = get_features(query_ids, QUERY_MODAL)
|
|
|
172 |
# output += "Genre:\n" + item['genre']+ '\n\n'
|
173 |
# output += "Description:\n" + item['text']+ '\n\n'
|
174 |
# output += "ABC notation:\n" + item['music']+ '\n\n'
|
175 |
+
print("Title:\n" + item['title'])
|
176 |
+
print("Artist:\n" + item['artist'])
|
177 |
+
print("Genre:\n" + item['genre'])
|
178 |
+
print("Description:\n" + item['text'])
|
179 |
+
print("ABC notation:\n" + item['music'])
|
180 |
return item["title"], item["artist"], item["genre"], item["text"], item["music"]
|
181 |
|
182 |
output_title = gr.outputs.Textbox(label="Title")
|