jerpint commited on
Commit
e8e4726
·
1 Parent(s): 601b866
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import whisper
2
+ import gradio as gr
3
+
4
+ model = whisper.load_hf_model(repo_id="jerpint/whisper", filename="small.pt")
5
+
6
+
7
+ def transcribe(audio, translate):
8
+
9
+ task = "translate" if translate else None
10
+ result = model.transcribe(audio, task=task)
11
+
12
+ return result["text"]
13
+
14
+
15
+ gr.Interface(
16
+ fn=transcribe,
17
+ inputs=[
18
+ gr.Audio(source="microphone", type="filepath"),
19
+ gr.Checkbox(label="Translate to english"),
20
+ ],
21
+ # examples=[["french.wav", True]],
22
+ outputs="text",
23
+ ).launch()