Spaces:
Sleeping
Sleeping
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() |