Tlanextli commited on
Commit
81b8cf7
·
1 Parent(s): 27c3537

Create app.py

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