Spaces:
Sleeping
Sleeping
Delete accent_gradio_app.py
Browse files- accent_gradio_app.py +0 -22
accent_gradio_app.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
-
# Load the model
|
5 |
-
pipe = pipeline("audio-classification", model="dima806/english_accents_classification")
|
6 |
-
|
7 |
-
# Define the inference function
|
8 |
-
def classify_accent(audio):
|
9 |
-
result = pipe(audio)
|
10 |
-
top_result = result[0]
|
11 |
-
top3 = "\n".join([f"{r['label']}: {r['score']:.2f}" for r in result[:3]])
|
12 |
-
return f"🎤 Top Prediction: {top_result['label']} ({top_result['score']:.2f})\n\nTop 3:\n{top3}"
|
13 |
-
|
14 |
-
# Launch the app
|
15 |
-
gr.Interface(
|
16 |
-
fn=classify_accent,
|
17 |
-
inputs=gr.Audio(type="filepath"),
|
18 |
-
outputs=gr.Textbox(),
|
19 |
-
title="Accent Classifier 🎧",
|
20 |
-
description="Upload an English audio sample to detect the speaker's accent.\nSupported: American, British, Indian, African, Australian.",
|
21 |
-
allow_flagging="never"
|
22 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|