empowerus commited on
Commit
f2e05a9
·
verified ·
1 Parent(s): 8f75c99

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ with gr.Blocks() as block:
4
+ gr.HTML(
5
+ f"""
6
+ <h1 style='text-align: center;'> Magic 8 Ball 🎱 </h1>
7
+ <h3 style='text-align: center;'> Ask a question and receive wisdom </h3>
8
+ <p style='text-align: center;'> Powered by <a href="https://github.com/huggingface/parler-tts"> Parler-TTS</a>
9
+ """
10
+ )
11
+ with gr.Group():
12
+ with gr.Row():
13
+ audio_out = gr.Audio(label="Spoken Answer", streaming=True, autoplay=True)
14
+ answer = gr.Textbox(label="Answer")
15
+ state = gr.State()
16
+ with gr.Row():
17
+ audio_in = gr.Audio(label="Speak your question", sources="microphone", type="filepath")
18
+
19
+ audio_in.stop_recording(generate_response, audio_in, [state, answer, audio_out])\
20
+ .then(fn=read_response, inputs=state, outputs=[answer, audio_out])
21
+
22
+ block.launch()