Spaces:
Building
Building
Commit Β·
8cc10a4
1
Parent(s): 8d1e1f2
Updated Gradio UI
Browse files
app.py
CHANGED
|
@@ -52,23 +52,25 @@ def predict_accent(audio):
|
|
| 52 |
label_map = {0: "Canadian English", 1: "England English"}
|
| 53 |
return label_map[predicted_class_id]
|
| 54 |
|
| 55 |
-
# Gradio Interface
|
| 56 |
-
interface = gr.Interface(
|
| 57 |
-
fn=predict_accent,
|
| 58 |
-
inputs=gr.Audio(sources=["upload", "microphone"], type="filepath", label="π€ Upload or Record Audio (WAV)"),
|
| 59 |
-
outputs=gr.Textbox(label="π£οΈ Predicted Accent"),
|
| 60 |
-
title="π Accent Classification App",
|
| 61 |
-
description="""
|
| 62 |
-
This app uses a fine-tuned **Wav2Vec2** model to classify English accents as either **Canadian** or **England**.
|
| 63 |
-
It supports both audio upload and direct recording.
|
| 64 |
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
-
π [GitHub: creativepurus](https://github.com/creativepurus)
|
| 69 |
|
| 70 |
-
""
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
|
|
|
| 52 |
label_map = {0: "Canadian English", 1: "England English"}
|
| 53 |
return label_map[predicted_class_id]
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
# Custom UI with gr.Blocks
|
| 57 |
+
with gr.Blocks() as demo:
|
| 58 |
+
gr.Markdown("## π£οΈ Accent Classification App")
|
| 59 |
+
gr.Markdown("This app classifies English accents as either **Canadian** or **England** using a fine-tuned Wav2Vec2 model.")
|
| 60 |
+
|
| 61 |
+
with gr.Row():
|
| 62 |
+
with gr.Column():
|
| 63 |
+
audio_input = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Upload or Record Audio (WAV)")
|
| 64 |
+
predict_button = gr.Button("Predict")
|
| 65 |
+
with gr.Column():
|
| 66 |
+
result_output = gr.Textbox(label="Predicted Accent")
|
| 67 |
|
| 68 |
+
predict_button.click(fn=predict_accent, inputs=audio_input, outputs=result_output)
|
|
|
|
| 69 |
|
| 70 |
+
gr.Markdown("---")
|
| 71 |
+
gr.Markdown("""
|
| 72 |
+
π¨βπ» Created by **Anand Purushottam**
|
| 73 |
+
π [GitHub](https://github.com/creativepurus) | [LinkedIn](https://linkedin.com/in/creativepurus)
|
| 74 |
+
""")
|
| 75 |
|
| 76 |
+
demo.launch()
|