File size: 661 Bytes
0899e82
e0c2b71
 
 
 
 
 
 
 
 
 
 
 
 
 
0899e82
 
 
 
e0c2b71
0899e82
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 torch
import whisper

### β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

title="Whisper to Emotion"

### β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

whisper_model = whisper.load_model("small")

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

record_input = gr.Audio(source="microphone",type="filepath", show_label=False)

def greet(name):
    return "Hello " + name + "!!"

iface = gr.Interface(fn=greet, inputs=record_input, outputs="text")
iface.launch()