Spaces:
Sleeping
Sleeping
arthur-stackadoc-com
commited on
Commit
•
f426af8
1
Parent(s):
29dff8e
app.py : added some audio for dev
Browse files
app.py
CHANGED
@@ -1,7 +1,30 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
3 |
|
4 |
+
class Hit():
|
5 |
+
def __init__(self):
|
6 |
+
self.score = 1
|
7 |
+
self.payload = {
|
8 |
+
"audio_path": "https://synthia-research.s3.amazonaws.com/music_db/7fbb0c4de0e4bdf5e1dec8f3e803174b.mp3"
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
def sound_search(query):
|
13 |
+
hits = [Hit() for _ in range(3)]
|
14 |
+
return [
|
15 |
+
gr.Audio(
|
16 |
+
hit.payload['audio_path'],
|
17 |
+
label=f"score: {hit.score}")
|
18 |
+
for hit in hits
|
19 |
+
]
|
20 |
+
|
21 |
+
|
22 |
+
with gr.Blocks() as demo:
|
23 |
+
gr.Markdown(
|
24 |
+
"""# Sound search database """
|
25 |
+
)
|
26 |
+
inp = gr.Textbox(placeholder="What sound are you looking for ?")
|
27 |
+
out = [gr.Audio(label=f"{x}") for x in range(3)] # Necessary to have different objs
|
28 |
+
inp.change(sound_search, inp, out)
|
29 |
+
|
30 |
+
demo.launch()
|