babelfish / app.py
jerpint's picture
Add app
e8e4726
raw
history blame
505 Bytes
import whisper
import gradio as gr
model = whisper.load_hf_model(repo_id="jerpint/whisper", filename="small.pt")
def transcribe(audio, translate):
task = "translate" if translate else None
result = model.transcribe(audio, task=task)
return result["text"]
gr.Interface(
fn=transcribe,
inputs=[
gr.Audio(source="microphone", type="filepath"),
gr.Checkbox(label="Translate to english"),
],
# examples=[["french.wav", True]],
outputs="text",
).launch()