|
import gradio as gr |
|
|
|
|
|
model = pipeline("audio-classification", model="HareemFatima/distilhubert-finetuned-stutterdetection") |
|
|
|
|
|
def classify_audio(audio_input): |
|
prediction = model(audio_input) |
|
predicted_label = prediction[0]["label"] |
|
|
|
|
|
label_map = { |
|
0: "nonstutter", |
|
1: "prolongation", |
|
2: "repetition", |
|
3: "blocks" |
|
} |
|
|
|
|
|
return label_map.get(predicted_label, "Unknown") |
|
|
|
|
|
audio_input = gr.inputs.Audio(source="microphone", type="file") |
|
output_label = gr.outputs.Label() |
|
gr.Interface(fn=classify_audio, inputs=audio_input, outputs=output_label).launch() |
|
|