Spaces:
Build error
Build error
Commit
·
af2295d
1
Parent(s):
d90da61
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Gradio demo
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
from model import speech_to_speech_translation
|
| 5 |
+
|
| 6 |
+
demo = gr.Blocks()
|
| 7 |
+
|
| 8 |
+
mic_translate = gr.Interface(
|
| 9 |
+
fn=speech_to_speech_translation,
|
| 10 |
+
inputs=gr.Audio(sources=["microphone"], type="filepath"),
|
| 11 |
+
outputs=gr.Audio(label="Generated Speech", type="numpy"),
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
file_translate = gr.Interface(
|
| 15 |
+
fn=speech_to_speech_translation,
|
| 16 |
+
inputs=gr.Audio(sources=["upload"], type="filepath"),
|
| 17 |
+
outputs=gr.Audio(label="Generated Speech", type="numpy"),
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
with demo:
|
| 21 |
+
gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
|
| 22 |
+
|
| 23 |
+
demo.launch(debug=True, share=True)
|