Spaces:
Build error
Build error
Samuel L Meyers
commited on
Commit
·
4e554fb
1
Parent(s):
fbfb629
Fixed transcription
Browse files
app.py
CHANGED
|
@@ -108,22 +108,11 @@ def main():
|
|
| 108 |
with gr.Row(variant="panel"):
|
| 109 |
audio = gr.Audio()
|
| 110 |
with gr.Row(variant="panel"):
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
gr.Audio(source="
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
title="Transcribe",
|
| 117 |
-
description=(
|
| 118 |
-
"Transcribe audio using Whisper v3 Large. "
|
| 119 |
-
),
|
| 120 |
-
)
|
| 121 |
-
|
| 122 |
-
def transcribe(audio):
|
| 123 |
-
if audio is None:
|
| 124 |
-
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
| 125 |
-
text = stt_pipe(audio, generate_kwargs={"language": "english", "task": "transcribe"})["text"]
|
| 126 |
-
return text
|
| 127 |
|
| 128 |
def synthesize_audio(text_str: str, model_name_str: str, speaker_str: str):
|
| 129 |
"""
|
|
@@ -151,6 +140,7 @@ def main():
|
|
| 151 |
return gr.Audio.update(value=(tts.get_sampling_rate(), samples))
|
| 152 |
|
| 153 |
generate.click(synthesize_audio, inputs=[text, model_name, speaker], outputs=audio, api_name="synthesize")
|
|
|
|
| 154 |
|
| 155 |
demo.queue(concurrency_count=1).launch()
|
| 156 |
|
|
|
|
| 108 |
with gr.Row(variant="panel"):
|
| 109 |
audio = gr.Audio()
|
| 110 |
with gr.Row(variant="panel"):
|
| 111 |
+
with gr.Column(variant="panel"):
|
| 112 |
+
stt_input_mic = gr.Audio(source="microphone", type="filepath", label="Record")
|
| 113 |
+
stt_input_file = gr.Audio(source="upload", type="filepath", label="Upload")
|
| 114 |
+
with gr.Column(variant="panel"):
|
| 115 |
+
stt_transcribe_btn = gr.Button("Transcribe")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
def synthesize_audio(text_str: str, model_name_str: str, speaker_str: str):
|
| 118 |
"""
|
|
|
|
| 140 |
return gr.Audio.update(value=(tts.get_sampling_rate(), samples))
|
| 141 |
|
| 142 |
generate.click(synthesize_audio, inputs=[text, model_name, speaker], outputs=audio, api_name="synthesize")
|
| 143 |
+
stt_transcribe_btn.click(transcribe_stt, inputs=stt_input_file, outputs=text, api_name="transcribe")
|
| 144 |
|
| 145 |
demo.queue(concurrency_count=1).launch()
|
| 146 |
|