whisper-zero / app.py
devingulliver's picture
Update app.py
281cf3d verified
raw
history blame
500 Bytes
import gradio as gr
import spaces
import torch
import io
import whisper
writer = whisper.utils.get_writer("srt", "/dev/null")
@spaces.GPU
def generate(file):
# get file to type bytes somehow
model = whisper.load_model("large", device="cuda")
audio = whisper.load_audio(file)
result = model.transcribe(audio)
out = io.StringIO()
writer.write_result(result, out)
return out.getvalue()
gr.Interface(fn=generate, inputs=gr.File(type="filepath"), outputs=gr.Text()).launch()