Tlanextli commited on
Commit
66461e1
·
1 Parent(s): 880c111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -2,7 +2,7 @@ import os
2
  import gradio as gr
3
  from transformers import pipeline
4
 
5
- title = "Speech to text for German"
6
 
7
  pipeline = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
8
  #pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")
@@ -11,14 +11,10 @@ def transcribeFile(audio_path : str) -> str:
11
  transcription = pipeline(audio_path)
12
  return transcription["text"]
13
 
14
- def transcribeMic(audio):
15
- sr, data = audio
16
- transcription = pipeline(data)
17
- return transcription["text"]
18
 
19
  app1 = gr.Interface(
20
  fn=transcribeFile,
21
- inputs=[gr.inputs.Audio(label="Upload audio file", type="filepath"), gr.Audio(source="microphone", type="filepath")],
22
  outputs="text",
23
  title=title
24
  )
@@ -32,7 +28,6 @@ app2 = gr.Interface(
32
  )
33
 
34
 
35
-
36
  demo = gr.TabbedInterface([app1, app2], ["Audio File", "Microphone"])
37
 
38
  if __name__ == "__main__":
 
2
  import gradio as gr
3
  from transformers import pipeline
4
 
5
+ title = "Transcribe speech in German"
6
 
7
  pipeline = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
8
  #pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")
 
11
  transcription = pipeline(audio_path)
12
  return transcription["text"]
13
 
 
 
 
 
14
 
15
  app1 = gr.Interface(
16
  fn=transcribeFile,
17
+ inputs=gr.inputs.Audio(label="Upload audio file", type="filepath"),
18
  outputs="text",
19
  title=title
20
  )
 
28
  )
29
 
30
 
 
31
  demo = gr.TabbedInterface([app1, app2], ["Audio File", "Microphone"])
32
 
33
  if __name__ == "__main__":