barbaroo commited on
Commit
65129d9
1 Parent(s): 2243a90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -3,23 +3,26 @@ import time
3
  from transformers import pipeline
4
 
5
  p = pipeline("automatic-speech-recognition",
6
- model = 'carlosdanielhernandezmena/wav2vec2-large-xlsr-53-faroese-100h')
7
 
8
- def transcribe(audio, state=""):
 
 
9
  time.sleep(3)
10
  text = p(audio)["text"]
11
  state += text + " "
12
  return state, state
13
 
14
-
15
  gr.Interface(
16
  fn=transcribe,
17
  inputs=[
18
  gr.inputs.Audio(source="microphone", type="filepath"),
19
- 'state'
 
20
  ],
21
  outputs=[
22
  "textbox",
23
  "state"
24
  ],
25
  live=True).launch()
 
 
3
  from transformers import pipeline
4
 
5
  p = pipeline("automatic-speech-recognition",
6
+ model="carlosdanielhernandezmena/wav2vec2-large-xlsr-53-faroese-100h")
7
 
8
+ def transcribe(audio, state="", uploaded_audio=""):
9
+ if uploaded_audio:
10
+ audio = uploaded_audio
11
  time.sleep(3)
12
  text = p(audio)["text"]
13
  state += text + " "
14
  return state, state
15
 
 
16
  gr.Interface(
17
  fn=transcribe,
18
  inputs=[
19
  gr.inputs.Audio(source="microphone", type="filepath"),
20
+ 'state',
21
+ gr.inputs.Audio(label="Upload Audio File", type="file", source="upload")
22
  ],
23
  outputs=[
24
  "textbox",
25
  "state"
26
  ],
27
  live=True).launch()
28
+