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

Updated Gradio UI

Browse files
Files changed (1) hide show
  1. app.py +36 -7
app.py CHANGED
@@ -52,16 +52,41 @@ def predict_accent(audio):
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
 
@@ -69,8 +94,12 @@ with gr.Blocks() as demo:
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()
 
52
  label_map = {0: "Canadian English", 1: "England English"}
53
  return label_map[predicted_class_id]
54
 
55
+ # # Gradio UI
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",
61
+ # description="This app classifies English accents as either Canadian or England using a fine-tuned Wav2Vec2 model.",
62
+ # allow_flagging="never"
63
+ # )
64
 
65
+
66
+ # Gradio UI with gr.Blocks
67
+
68
+ # Gradio UI with gr.Blocks and Custom Styling
69
+
70
+ custom_css = """
71
+ #predict-btn {
72
+ background-color: orange !important;
73
+ color: white !important;
74
+ font-weight: bold;
75
+ }
76
+ #author-section {
77
+ font-size: 18px;
78
+ font-weight: 500;
79
+ }
80
+ """
81
+
82
+ with gr.Blocks(css=custom_css) as demo:
83
  gr.Markdown("## πŸ—£οΈ Accent Classification App")
84
  gr.Markdown("This app classifies English accents as either **Canadian** or **England** using a fine-tuned Wav2Vec2 model.")
85
 
86
  with gr.Row():
87
  with gr.Column():
88
  audio_input = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Upload or Record Audio (WAV)")
89
+ predict_button = gr.Button("Predict Accent", elem_id="predict-btn")
90
  with gr.Column():
91
  result_output = gr.Textbox(label="Predicted Accent")
92
 
 
94
 
95
  gr.Markdown("---")
96
  gr.Markdown("""
97
+ <div id="author-section">
98
+ πŸ‘¨β€πŸ’» Created by <strong>Anand Purushottam</strong>
99
+ πŸ”— <a href="https://github.com/creativepurus" target="_blank">GitHub</a> |
100
+ <a href="https://linkedin.com/in/creativepurus" target="_blank">LinkedIn</a>
101
+ </div>
102
+ """, unsafe_allow_html=True
103
+ )
104
 
105
+ demo.launch()