Spaces:
Running
Running
Ajout
Browse files
.env
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
QDRANT_URL=https://
|
2 |
-
QDRANT_KEY=
|
3 |
AWS_ACCESS_KEY_ID=AKIAWOUASMWP5DM6RZG2
|
4 |
AWS_SECRET_ACCESS_KEY=HfD73+MKijEgNlVRAkTEgRuNeivyFeYdrtLUqOmq
|
|
|
1 |
+
QDRANT_URL=https://006817a4-0b45-4db8-a4e5-1f916808e19b.us-east4-0.gcp.cloud.qdrant.io:6333
|
2 |
+
QDRANT_KEY=d9MUWQOMUA7JGBdpoFRtmou-h4Pf-e9uCrr0jMtUfAvvk4osqL_JtA
|
3 |
AWS_ACCESS_KEY_ID=AKIAWOUASMWP5DM6RZG2
|
4 |
AWS_SECRET_ACCESS_KEY=HfD73+MKijEgNlVRAkTEgRuNeivyFeYdrtLUqOmq
|
app.py
CHANGED
@@ -12,8 +12,6 @@ load_dotenv()
|
|
12 |
QDRANT_URL = os.getenv('QDRANT_URL')
|
13 |
QDRANT_KEY = os.getenv('QDRANT_KEY')
|
14 |
|
15 |
-
# Vérifier les valeurs récupérées
|
16 |
-
|
17 |
|
18 |
try:
|
19 |
# Vérifier que les variables sont correctement récupérées
|
@@ -35,25 +33,18 @@ try:
|
|
35 |
|
36 |
def sound_search(query):
|
37 |
try:
|
38 |
-
print(f"[DEBUG] Received query: {query}")
|
39 |
text_inputs = processor(text=query, return_tensors="pt")
|
40 |
-
print(f"[DEBUG] Text inputs: {text_inputs}")
|
41 |
text_embed = model.get_text_features(**text_inputs)[0]
|
42 |
-
print(f"Text embed: {text_embed}")
|
43 |
|
44 |
hits = client.search(
|
45 |
-
collection_name="
|
46 |
query_vector=text_embed.tolist(),
|
47 |
limit=max_results,
|
48 |
)
|
49 |
-
print(f"Search results: {hits}")
|
50 |
-
print([
|
51 |
-
hit.payload['audio_s3url']
|
52 |
|
53 |
-
for hit in hits])
|
54 |
return [
|
55 |
gr.Audio(
|
56 |
-
hit.payload['
|
57 |
label=f"style: {hit.payload['style']} -- score: {hit.score}")
|
58 |
for hit in hits
|
59 |
]
|
@@ -65,7 +56,6 @@ try:
|
|
65 |
gr.Markdown("# Sound search database")
|
66 |
inp = gr.Textbox(placeholder="What sound are you looking for?")
|
67 |
out = [gr.Audio(label=f"{x}") for x in range(max_results)]
|
68 |
-
print(sound_search("fun"))
|
69 |
inp.submit(sound_search, inputs=inp, outputs=out)
|
70 |
|
71 |
demo.launch()
|
|
|
12 |
QDRANT_URL = os.getenv('QDRANT_URL')
|
13 |
QDRANT_KEY = os.getenv('QDRANT_KEY')
|
14 |
|
|
|
|
|
15 |
|
16 |
try:
|
17 |
# Vérifier que les variables sont correctement récupérées
|
|
|
33 |
|
34 |
def sound_search(query):
|
35 |
try:
|
|
|
36 |
text_inputs = processor(text=query, return_tensors="pt")
|
|
|
37 |
text_embed = model.get_text_features(**text_inputs)[0]
|
|
|
38 |
|
39 |
hits = client.search(
|
40 |
+
collection_name="demo_spaces_db",
|
41 |
query_vector=text_embed.tolist(),
|
42 |
limit=max_results,
|
43 |
)
|
|
|
|
|
|
|
44 |
|
|
|
45 |
return [
|
46 |
gr.Audio(
|
47 |
+
hit.payload['audio_s3url'],
|
48 |
label=f"style: {hit.payload['style']} -- score: {hit.score}")
|
49 |
for hit in hits
|
50 |
]
|
|
|
56 |
gr.Markdown("# Sound search database")
|
57 |
inp = gr.Textbox(placeholder="What sound are you looking for?")
|
58 |
out = [gr.Audio(label=f"{x}") for x in range(max_results)]
|
|
|
59 |
inp.submit(sound_search, inputs=inp, outputs=out)
|
60 |
|
61 |
demo.launch()
|