File size: 473 Bytes
c464395
e9e7628
 
deac1ce
bc81f54
c464395
bc81f54
 
e9e7628
9d171cc
c464395
e9e7628
29e43f4
e9e7628
6bf674d
e9e7628
5b445a1
3199196
e9e7628
9d171cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import whisperx
import whisper
import torch
import spaces


@spaces.GPU
def transcribe(audio_file):
    device = "cuda" if torch.cuda.is_available() else "cpu"

    # Transcribe with original Whisper
    model = whisper.load_model("medium", device)
    result = model.transcribe(audio_file)
    return result

inputs = gr.Audio(sources="upload", type="filepath")
outputs = gr.JSON()

gr.Interface(fn=transcribe, inputs=inputs, outputs=outputs).launch()