Spaces:
Running
on
Zero
Running
on
Zero
import gradio as gr | |
import spaces | |
import torch | |
import io | |
import whisper | |
writer = whisper.utils.get_writer("srt", "/dev/null") | |
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() |