Ajouter le script Gradio et les dépendances
Browse files
app.py
CHANGED
|
@@ -15,7 +15,6 @@ model.load_ckpt() # download the default pretrained checkpoint.
|
|
| 15 |
# Gradio Interface #################################################################################
|
| 16 |
max_results = 10
|
| 17 |
|
| 18 |
-
|
| 19 |
def sound_search(query):
|
| 20 |
text_embed = model.get_text_embedding([query, ''])[0] # trick because can't accept singleton
|
| 21 |
hits = client.search(
|
|
@@ -30,7 +29,6 @@ def sound_search(query):
|
|
| 30 |
for hit in hits
|
| 31 |
]
|
| 32 |
|
| 33 |
-
|
| 34 |
with gr.Blocks() as demo:
|
| 35 |
gr.Markdown(
|
| 36 |
"""# Sound search database """
|
|
@@ -39,4 +37,4 @@ with gr.Blocks() as demo:
|
|
| 39 |
out = [gr.Audio(label=f"{x}") for x in range(max_results)] # Necessary to have different objs
|
| 40 |
inp.change(sound_search, inp, out)
|
| 41 |
|
| 42 |
-
demo.launch()
|
|
|
|
| 15 |
# Gradio Interface #################################################################################
|
| 16 |
max_results = 10
|
| 17 |
|
|
|
|
| 18 |
def sound_search(query):
|
| 19 |
text_embed = model.get_text_embedding([query, ''])[0] # trick because can't accept singleton
|
| 20 |
hits = client.search(
|
|
|
|
| 29 |
for hit in hits
|
| 30 |
]
|
| 31 |
|
|
|
|
| 32 |
with gr.Blocks() as demo:
|
| 33 |
gr.Markdown(
|
| 34 |
"""# Sound search database """
|
|
|
|
| 37 |
out = [gr.Audio(label=f"{x}") for x in range(max_results)] # Necessary to have different objs
|
| 38 |
inp.change(sound_search, inp, out)
|
| 39 |
|
| 40 |
+
demo.launch()
|
setup.sh
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
python database.py
|
| 2 |
+
python app.py
|