Spaces:
Configuration error
Configuration error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -147,10 +147,7 @@ def diagnose_speech_hf(
|
|
| 147 |
|
| 148 |
|
| 149 |
# Construct Gradio Modern Interface
|
| 150 |
-
with gr.Blocks(
|
| 151 |
-
title="Anvaya | Speech Pathology Diagnostics",
|
| 152 |
-
theme=gr.themes.Soft(primary_hue="sky", neutral_hue="slate"),
|
| 153 |
-
) as demo:
|
| 154 |
gr.Markdown("""
|
| 155 |
# ANVAYA · Clinical Speech Pathology & Articulation Diagnostics
|
| 156 |
### Multi-Modal Diagnostics: Neural Disfluency · Rhotacism ('r') · Sigmatism ('s' Lisp) · Praat Vocal Phonation
|
|
@@ -161,18 +158,20 @@ with gr.Blocks(
|
|
| 161 |
audio_input = gr.Audio(
|
| 162 |
sources=["microphone", "upload"],
|
| 163 |
type="filepath",
|
| 164 |
-
label="Audio Ingestion (Record or Upload Audio)",
|
| 165 |
)
|
| 166 |
|
| 167 |
gr.Markdown("#### Single-Word Practice Presets:")
|
| 168 |
with gr.Row():
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
|
|
|
| 172 |
with gr.Row():
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
|
|
|
| 176 |
|
| 177 |
target_preset = gr.Dropdown(
|
| 178 |
choices=list(SENTENCE_PRESETS.keys()),
|
|
@@ -186,8 +185,18 @@ with gr.Blocks(
|
|
| 186 |
lines=2,
|
| 187 |
)
|
| 188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
target_preset.change(
|
| 190 |
-
lambda k: SENTENCE_PRESETS.get(k, ""),
|
| 191 |
inputs=[target_preset],
|
| 192 |
outputs=[target_text],
|
| 193 |
)
|
|
@@ -200,7 +209,7 @@ with gr.Blocks(
|
|
| 200 |
|
| 201 |
diagnose_btn = gr.Button("Run Diagnostic Analysis", variant="primary", size="lg")
|
| 202 |
|
| 203 |
-
with gr.Column(scale=
|
| 204 |
with gr.Row():
|
| 205 |
kpi_strat = gr.Textbox(label="Clinical Stratification", interactive=False)
|
| 206 |
kpi_fluency = gr.Textbox(label="Fluency Index", interactive=False)
|
|
@@ -219,4 +228,4 @@ with gr.Blocks(
|
|
| 219 |
)
|
| 220 |
|
| 221 |
if __name__ == "__main__":
|
| 222 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
# Construct Gradio Modern Interface
|
| 150 |
+
with gr.Blocks(title="Anvaya | Speech Pathology Diagnostics") as demo:
|
|
|
|
|
|
|
|
|
|
| 151 |
gr.Markdown("""
|
| 152 |
# ANVAYA · Clinical Speech Pathology & Articulation Diagnostics
|
| 153 |
### Multi-Modal Diagnostics: Neural Disfluency · Rhotacism ('r') · Sigmatism ('s' Lisp) · Praat Vocal Phonation
|
|
|
|
| 158 |
audio_input = gr.Audio(
|
| 159 |
sources=["microphone", "upload"],
|
| 160 |
type="filepath",
|
| 161 |
+
label="Audio Ingestion (Record Microphone or Upload Audio)",
|
| 162 |
)
|
| 163 |
|
| 164 |
gr.Markdown("#### Single-Word Practice Presets:")
|
| 165 |
with gr.Row():
|
| 166 |
+
btn_w1 = gr.Button("rabbit", size="sm")
|
| 167 |
+
btn_w2 = gr.Button("red", size="sm")
|
| 168 |
+
btn_w3 = gr.Button("sun", size="sm")
|
| 169 |
+
btn_w4 = gr.Button("sweet", size="sm")
|
| 170 |
with gr.Row():
|
| 171 |
+
btn_w5 = gr.Button("three", size="sm")
|
| 172 |
+
btn_w6 = gr.Button("water", size="sm")
|
| 173 |
+
btn_w7 = gr.Button("kitten", size="sm")
|
| 174 |
+
btn_w8 = gr.Button("spot", size="sm")
|
| 175 |
|
| 176 |
target_preset = gr.Dropdown(
|
| 177 |
choices=list(SENTENCE_PRESETS.keys()),
|
|
|
|
| 185 |
lines=2,
|
| 186 |
)
|
| 187 |
|
| 188 |
+
# Bind Word Preset Buttons to set target phrase text
|
| 189 |
+
btn_w1.click(fn=lambda: "rabbit", outputs=[target_text])
|
| 190 |
+
btn_w2.click(fn=lambda: "red", outputs=[target_text])
|
| 191 |
+
btn_w3.click(fn=lambda: "sun", outputs=[target_text])
|
| 192 |
+
btn_w4.click(fn=lambda: "sweet", outputs=[target_text])
|
| 193 |
+
btn_w5.click(fn=lambda: "three", outputs=[target_text])
|
| 194 |
+
btn_w6.click(fn=lambda: "water", outputs=[target_text])
|
| 195 |
+
btn_w7.click(fn=lambda: "kitten", outputs=[target_text])
|
| 196 |
+
btn_w8.click(fn=lambda: "spot", outputs=[target_text])
|
| 197 |
+
|
| 198 |
target_preset.change(
|
| 199 |
+
fn=lambda k: SENTENCE_PRESETS.get(k, ""),
|
| 200 |
inputs=[target_preset],
|
| 201 |
outputs=[target_text],
|
| 202 |
)
|
|
|
|
| 209 |
|
| 210 |
diagnose_btn = gr.Button("Run Diagnostic Analysis", variant="primary", size="lg")
|
| 211 |
|
| 212 |
+
with gr.Column(scale=2):
|
| 213 |
with gr.Row():
|
| 214 |
kpi_strat = gr.Textbox(label="Clinical Stratification", interactive=False)
|
| 215 |
kpi_fluency = gr.Textbox(label="Fluency Index", interactive=False)
|
|
|
|
| 228 |
)
|
| 229 |
|
| 230 |
if __name__ == "__main__":
|
| 231 |
+
demo.queue().launch(server_name="0.0.0.0", server_port=7860, ssr_mode=False)
|