Spaces:
Running
Running
Commit
•
02ff319
1
Parent(s):
e35fb55
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
-
import random
|
3 |
-
import os
|
4 |
|
5 |
-
def
|
6 |
-
|
7 |
-
audio_files = [f for f in os.listdir(audio_folder) if f.endswith('.mp3') or f.endswith('.wav')]
|
8 |
-
chosen_audio = random.choice(audio_files)
|
9 |
-
return os.path.join(audio_folder, chosen_audio)
|
10 |
|
11 |
with gr.Blocks() as demo:
|
12 |
-
gr.Markdown("##
|
13 |
-
play_button = gr.Button("
|
14 |
audio_output = gr.Audio()
|
15 |
|
16 |
-
play_button.click(fn=
|
17 |
|
18 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
+
def play_audio():
|
4 |
+
return "bababui.mp3"
|
|
|
|
|
|
|
5 |
|
6 |
with gr.Blocks() as demo:
|
7 |
+
gr.Markdown("## bababui")
|
8 |
+
play_button = gr.Button("bababui")
|
9 |
audio_output = gr.Audio()
|
10 |
|
11 |
+
play_button.click(fn=play_audio, outputs=audio_output)
|
12 |
|
13 |
demo.launch()
|