creativepurus commited on
Commit
8cc10a4
Β·
1 Parent(s): 8d1e1f2

Updated Gradio UI

Browse files
Files changed (1) hide show
  1. app.py +18 -16
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
- πŸ‘¨β€πŸ’» **Author**: [Anand Purushottam](https://www.linkedin.com/in/creativepurus/)
68
- πŸ”— [GitHub: creativepurus](https://github.com/creativepurus)
69
 
70
- """,
71
- allow_flagging="never"
72
- )
 
 
73
 
74
- interface.launch()
 
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()