Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -181,7 +181,7 @@ def create_gradio_interface():
|
|
| 181 |
"""Create and configure the Gradio interface for Hugging Face."""
|
| 182 |
|
| 183 |
# Initialize the app with default model
|
| 184 |
-
app = KeywordSpottingApp(model_size="
|
| 185 |
|
| 186 |
def classify_audio(audio_input, audio_file, keywords, model_size, access_token):
|
| 187 |
"""Wrapper function for Gradio interface."""
|
|
@@ -231,7 +231,7 @@ def create_gradio_interface():
|
|
| 231 |
5. **Click "Analyze Audio"** to get results
|
| 232 |
|
| 233 |
### 💡 Example Keywords:
|
| 234 |
-
`
|
| 235 |
""")
|
| 236 |
|
| 237 |
with gr.Row():
|
|
@@ -247,17 +247,18 @@ def create_gradio_interface():
|
|
| 247 |
gr.Markdown("### 🤖 Model Selection")
|
| 248 |
model_selector = gr.Dropdown(
|
| 249 |
choices=["tiny", "base", "small", "medium"],
|
| 250 |
-
value="
|
| 251 |
label="Whisper Model",
|
| 252 |
info="tiny=fastest, base=balanced, small=better accuracy, medium=best accuracy"
|
| 253 |
)
|
| 254 |
|
| 255 |
gr.Markdown("### 🔤 Keywords")
|
| 256 |
-
gr.Markdown("*Example:
|
| 257 |
keywords_input = gr.Textbox(
|
| 258 |
label="Keywords (comma-separated)",
|
| 259 |
-
placeholder="
|
| 260 |
-
|
|
|
|
| 261 |
)
|
| 262 |
|
| 263 |
gr.Markdown("### 🎵 Audio Input")
|
|
@@ -301,7 +302,7 @@ def create_gradio_interface():
|
|
| 301 |
|
| 302 |
model_status_output = gr.Textbox(
|
| 303 |
label="Model Status",
|
| 304 |
-
value="Current model:
|
| 305 |
interactive=False,
|
| 306 |
elem_classes=["status-box"]
|
| 307 |
)
|
|
@@ -317,30 +318,12 @@ def create_gradio_interface():
|
|
| 317 |
gr.Markdown("""
|
| 318 |
## 💡 Usage Examples:
|
| 319 |
|
| 320 |
-
**Suggested Spanish keywords:**
|
| 321 |
-
- Greetings: `hola, buenos días, buenas tardes, adiós`
|
| 322 |
-
- Courtesy: `gracias, por favor, disculpe, perdón`
|
| 323 |
-
- Responses: `sí, no, tal vez, claro`
|
| 324 |
-
- Numbers: `uno, dos, tres, cuatro, cinco`
|
| 325 |
-
- Colors: `rojo, azul, verde, amarillo`
|
| 326 |
-
|
| 327 |
**Tips:**
|
| 328 |
- Use clear audio without background noise
|
| 329 |
- Speak at normal speed
|
| 330 |
- Keywords can appear anywhere in the audio
|
| 331 |
- Works best with common Spanish words
|
| 332 |
-
|
| 333 |
-
## 🔧 Technical Details:
|
| 334 |
-
- **Model**: OpenAI Whisper (speech transcription)
|
| 335 |
-
- **Languages**: Optimized for Spanish, works with others
|
| 336 |
-
- **Processing**: Up to 30 seconds, 48kHz sampling rate
|
| 337 |
-
- **Approach**: Transcription + text matching
|
| 338 |
-
|
| 339 |
-
## 🤖 Model Comparison:
|
| 340 |
-
- **tiny**: Fastest, basic accuracy (72MB)
|
| 341 |
-
- **base**: Balanced speed/accuracy (139MB)
|
| 342 |
-
- **small**: Better accuracy, slower (461MB)
|
| 343 |
-
- **medium**: Best accuracy, slowest (1.46GB)
|
| 344 |
""")
|
| 345 |
|
| 346 |
return interface
|
|
|
|
| 181 |
"""Create and configure the Gradio interface for Hugging Face."""
|
| 182 |
|
| 183 |
# Initialize the app with default model
|
| 184 |
+
app = KeywordSpottingApp(model_size="tiny")
|
| 185 |
|
| 186 |
def classify_audio(audio_input, audio_file, keywords, model_size, access_token):
|
| 187 |
"""Wrapper function for Gradio interface."""
|
|
|
|
| 231 |
5. **Click "Analyze Audio"** to get results
|
| 232 |
|
| 233 |
### 💡 Example Keywords:
|
| 234 |
+
`Sí, Claro, No, Nunca, Quizás, Tal vez, Por supuesto, En absoluto`
|
| 235 |
""")
|
| 236 |
|
| 237 |
with gr.Row():
|
|
|
|
| 247 |
gr.Markdown("### 🤖 Model Selection")
|
| 248 |
model_selector = gr.Dropdown(
|
| 249 |
choices=["tiny", "base", "small", "medium"],
|
| 250 |
+
value="tiny",
|
| 251 |
label="Whisper Model",
|
| 252 |
info="tiny=fastest, base=balanced, small=better accuracy, medium=best accuracy"
|
| 253 |
)
|
| 254 |
|
| 255 |
gr.Markdown("### 🔤 Keywords")
|
| 256 |
+
gr.Markdown("*Example: Sí, No, Quizás, Claro, Nunca*")
|
| 257 |
keywords_input = gr.Textbox(
|
| 258 |
label="Keywords (comma-separated)",
|
| 259 |
+
placeholder="Si,Claro,Por supuesto,Exacto,De acuerdo,Seguro,Cierto,Sin duda,Así es,Correcto,No,Nunca,Jamás,De ninguna,En absoluto,Para nada,Negativo,Falso,Ni hablar,Imposible,Quizás,Tal vez,Puede ser,No sé,A lo mejor,Es posible,Dudo mucho,Quién sabe,Probablemente,No estoy seguro",
|
| 260 |
+
value="Si,Claro,Por supuesto,Exacto,De acuerdo,Seguro,Cierto,Sin duda,Así es,Correcto,No,Nunca,Jamás,De ninguna,En absoluto,Para nada,Negativo,Falso,Ni hablar,Imposible,Quizás,Tal vez,Puede ser,No sé,A lo mejor,Es posible,Dudo mucho,Quién sabe,Probablemente,No estoy seguro",
|
| 261 |
+
lines=3
|
| 262 |
)
|
| 263 |
|
| 264 |
gr.Markdown("### 🎵 Audio Input")
|
|
|
|
| 302 |
|
| 303 |
model_status_output = gr.Textbox(
|
| 304 |
label="Model Status",
|
| 305 |
+
value="Current model: tiny",
|
| 306 |
interactive=False,
|
| 307 |
elem_classes=["status-box"]
|
| 308 |
)
|
|
|
|
| 318 |
gr.Markdown("""
|
| 319 |
## 💡 Usage Examples:
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
**Tips:**
|
| 322 |
- Use clear audio without background noise
|
| 323 |
- Speak at normal speed
|
| 324 |
- Keywords can appear anywhere in the audio
|
| 325 |
- Works best with common Spanish words
|
| 326 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
""")
|
| 328 |
|
| 329 |
return interface
|