|
|
from transformers import pipeline |
|
|
import gradio as gr |
|
|
|
|
|
model_id = "pollner/distilhubert-finetuned-ravdess" |
|
|
classifier = pipeline("audio-classification", model=model_id) |
|
|
|
|
|
def classify_audio(audio_file): |
|
|
|
|
|
result = classifier(audio_file) |
|
|
return result |
|
|
|
|
|
iface = gr.Interface( |
|
|
fn=classify_audio, |
|
|
inputs=gr.Audio(type="filepath"), |
|
|
outputs=gr.JSON(label="Classification result"), |
|
|
title="Emotion recognition from speech (RAVDESS)", |
|
|
description="Classifies emotion from audio using distilhubert-finetuned-ravdess" |
|
|
) |
|
|
|
|
|
iface.launch() |