File size: 665 Bytes
804a126
5ce55d8
b0df8f4
 
804a126
124b67b
804a126
90883a0
3edc82e
 
124b67b
14aba69
 
5652706
 
 
e220118
14aba69
 
 
 
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
from datasets import load_dataset, Audio
import torch
from transformers import pipeline

pipeline = pipeline("audio-classification", model="DanielDBGC/my_awesome_lang_class_mind_model")

def predict(input_sound):
    print(input_sound)
    predictions = pipeline(input_sound)
    return {p["label"]: p["score"] for p in predictions} 

gradio_app = gr.Interface(
    fn = predict,
    inputs= [gr.Audio(label="Record or upload someone speaking!", sources=['upload', 'microphone'], type="filepath")],
    outputs= [gr.Label(label="Result", num_top_classes=3)],
    title="Guess the language!",
)

if __name__ == "__main__":
    gradio_app.launch()