sonobit commited on
Commit
bba37db
·
1 Parent(s): b270fb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -1,13 +1,19 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- p = pipeline('wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut')
 
5
 
6
  def transcribe(audio):
7
- text = p(audio)["text"]
 
8
  return text
9
 
 
 
 
 
10
  gr.Interface(
11
  fn=transcribe,
12
- inputs=gr.Audio(source="microphone", type="filepath"),
13
  outputs="text").launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Specify the task for the pipeline
5
+ p = pipeline('text-generation', model='wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut')
6
 
7
  def transcribe(audio):
8
+ # Pass the audio file to the pipeline and obtain the output
9
+ text = p(audio)["generated_text"]
10
  return text
11
 
12
+ # Create a GraudioInput object for the audio input
13
+ audio_input = gr.Audio(source="microphone", type="filepath")
14
+
15
+ # Use the GraudioInput object as the value for the inputs argument
16
  gr.Interface(
17
  fn=transcribe,
18
+ inputs=audio_input,
19
  outputs="text").launch()