demavior commited on
Commit
e07643f
·
verified ·
1 Parent(s): 8c7801f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -1,4 +1,11 @@
 
 
 
 
1
  import torchaudio
 
 
 
2
 
3
  def transcribe(audio):
4
  # Extract the sample rate and audio data from the tuple
@@ -32,3 +39,12 @@ def transcribe(audio):
32
 
33
  prediction = pipe(audio_tensor)["text"]
34
  return prediction
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+ import torch
5
  import torchaudio
6
+ import numpy as np
7
+
8
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
9
 
10
  def transcribe(audio):
11
  # Extract the sample rate and audio data from the tuple
 
39
 
40
  prediction = pipe(audio_tensor)["text"]
41
  return prediction
42
+ gradio_app = gr.Interface(
43
+ fn=transcribe,
44
+ inputs=gr.Audio(label="Input"),
45
+ outputs=gr.Textbox(label="Result"),
46
+ title="Transcribed",
47
+ )
48
+
49
+ if __name__ == "__main__":
50
+ gradio_app.launch()