Spaces:
Runtime error
Runtime error
Create app_ge.py
Browse files
app_ge.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
pipeline = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
|
6 |
+
#pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")
|
7 |
+
|
8 |
+
def transcribe(audio_path : str) -> str:
|
9 |
+
transcription = pipeline(audio_path)
|
10 |
+
return transcription["text"]
|
11 |
+
|
12 |
+
|
13 |
+
demo = gr.Interface(
|
14 |
+
fn=transcribe,
|
15 |
+
#inputs="microphone",
|
16 |
+
inputs=gr.inputs.Audio(label="Upload audio file", type="filepath"),
|
17 |
+
outputs="text"
|
18 |
+
)
|
19 |
+
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
demo.launch()
|