Spaces:
Runtime error
Runtime error
aar2dee2 commited on
Commit ·
7bb2b6f
1
Parent(s): 7fa5768
redo gradio interface for audio
Browse files- app.py +27 -5
- data/example/strauss-oppenheimer.wav +3 -0
app.py
CHANGED
|
@@ -108,10 +108,32 @@ def main(input_audio):
|
|
| 108 |
logger.error("Failed to synthesize response: %s", e)
|
| 109 |
break
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
demo = gr.Interface(fn=main, inputs=gr.Audio(
|
| 113 |
-
source="microphone",
|
| 114 |
-
type="filepath",
|
| 115 |
-
interactive=True,
|
| 116 |
-
), outputs="audio")
|
| 117 |
demo.launch()
|
|
|
|
| 108 |
logger.error("Failed to synthesize response: %s", e)
|
| 109 |
break
|
| 110 |
|
| 111 |
+
# Refer @link https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/main/app.py
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
demo = gr.Blocks()
|
| 115 |
+
title = "Chatty Vader"
|
| 116 |
+
description = "Darth Vader resurrected with all the knowledge of humanity"
|
| 117 |
+
|
| 118 |
+
mic_translate = gr.Interface(
|
| 119 |
+
fn=main,
|
| 120 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
| 121 |
+
outputs=gr.Audio(label="Generated Speech", type="wav"),
|
| 122 |
+
title=title,
|
| 123 |
+
description=description,
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
file_translate = gr.Interface(
|
| 127 |
+
fn=main,
|
| 128 |
+
inputs=gr.Audio(source="upload", type="filepath"),
|
| 129 |
+
outputs=gr.Audio(label="Generated Speech", type="wav"),
|
| 130 |
+
examples=[["./data/example/strauss-oppenheimer.wav"]],
|
| 131 |
+
title=title,
|
| 132 |
+
description=description,
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
with demo:
|
| 136 |
+
gr.TabbedInterface([mic_translate, file_translate],
|
| 137 |
+
["Microphone", "Audio File"])
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
demo.launch()
|
data/example/strauss-oppenheimer.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d7ac18c3b5249c71977b4bc00c2641e8b6a16a133e517ac8af23df2a9a055e6
|
| 3 |
+
size 1458220
|