Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -125,6 +125,12 @@ def video_to_text(video_path):
|
|
| 125 |
video.audio.write_audiofile(audio_path, codec="pcm_s16le")
|
| 126 |
return speech_to_text(audio_path)
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
with gr.Blocks() as demo:
|
| 129 |
gr.Markdown("### تبدیل گفتار فارسی به متن با استفاده از Wav2Vec2")
|
| 130 |
|
|
@@ -139,6 +145,7 @@ with gr.Blocks() as demo:
|
|
| 139 |
audio_output = gr.Textbox(label="متن استخراج شده")
|
| 140 |
audio_button = gr.Button("تبدیل به متن")
|
| 141 |
audio_button.click(speech_to_text, inputs=audio_input, outputs=audio_output)
|
|
|
|
| 142 |
|
| 143 |
with gr.Tab("ضبط صدا"):
|
| 144 |
mic_input = gr.Audio(sources="microphone", type="filepath")
|
|
|
|
| 125 |
video.audio.write_audiofile(audio_path, codec="pcm_s16le")
|
| 126 |
return speech_to_text(audio_path)
|
| 127 |
|
| 128 |
+
examples_audio = [
|
| 129 |
+
["examples/audio1.m4a"],
|
| 130 |
+
["examples/audio2.m4a"],
|
| 131 |
+
["examples/audio3.m4a"]
|
| 132 |
+
]
|
| 133 |
+
|
| 134 |
with gr.Blocks() as demo:
|
| 135 |
gr.Markdown("### تبدیل گفتار فارسی به متن با استفاده از Wav2Vec2")
|
| 136 |
|
|
|
|
| 145 |
audio_output = gr.Textbox(label="متن استخراج شده")
|
| 146 |
audio_button = gr.Button("تبدیل به متن")
|
| 147 |
audio_button.click(speech_to_text, inputs=audio_input, outputs=audio_output)
|
| 148 |
+
gr.Examples(examples=examples_audio, inputs=audio_input)
|
| 149 |
|
| 150 |
with gr.Tab("ضبط صدا"):
|
| 151 |
mic_input = gr.Audio(sources="microphone", type="filepath")
|