Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# app.py β Faster Urdu ASR + LLM Polisher (right-side output,
|
| 2 |
|
| 3 |
import os
|
| 4 |
import json
|
|
@@ -134,10 +134,6 @@ def enhance_lines_with_llm(
|
|
| 134 |
return [basic_urdu_cleanup(x) for x in lines]
|
| 135 |
|
| 136 |
def test_groq(api_key: Optional[str], temperature: float, system_prompt: str) -> str:
|
| 137 |
-
"""
|
| 138 |
-
Quick self-test for LLM connectivity + model availability.
|
| 139 |
-
Returns a short success or error message rendered in the UI.
|
| 140 |
-
"""
|
| 141 |
client, err = get_groq_client(api_key)
|
| 142 |
if not client:
|
| 143 |
return f"β LLM not ready: {err}"
|
|
@@ -277,19 +273,10 @@ def transcribe_audio(
|
|
| 277 |
raise gr.Error(f"Unsupported format: {output_format}")
|
| 278 |
|
| 279 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 280 |
-
# UI (right-side output,
|
| 281 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 282 |
|
| 283 |
-
theme = gr.themes.Soft(
|
| 284 |
-
primary_hue="rose",
|
| 285 |
-
secondary_hue="violet",
|
| 286 |
-
neutral_hue="slate",
|
| 287 |
-
).set(
|
| 288 |
-
body_background_fill="#0b0f14",
|
| 289 |
-
block_background_fill="#0f1720",
|
| 290 |
-
block_border_width="1px",
|
| 291 |
-
block_border_radius="16px",
|
| 292 |
-
)
|
| 293 |
|
| 294 |
with gr.Blocks(
|
| 295 |
title="Faster Urdu ASR + LLM Polisher",
|
|
@@ -304,10 +291,10 @@ with gr.Blocks(
|
|
| 304 |
sources=["upload", "microphone"],
|
| 305 |
type="filepath",
|
| 306 |
label="Upload or Record Audio",
|
| 307 |
-
#
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
)
|
| 312 |
|
| 313 |
with gr.Accordion("Transcription Settings", open=False):
|
|
|
|
| 1 |
+
# app.py β Faster Urdu ASR + LLM Polisher (right-side output, unified audio, Soft theme)
|
| 2 |
|
| 3 |
import os
|
| 4 |
import json
|
|
|
|
| 134 |
return [basic_urdu_cleanup(x) for x in lines]
|
| 135 |
|
| 136 |
def test_groq(api_key: Optional[str], temperature: float, system_prompt: str) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
client, err = get_groq_client(api_key)
|
| 138 |
if not client:
|
| 139 |
return f"β LLM not ready: {err}"
|
|
|
|
| 273 |
raise gr.Error(f"Unsupported format: {output_format}")
|
| 274 |
|
| 275 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 276 |
+
# UI (right-side output, Soft theme, single audio widget, trimmed controls)
|
| 277 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 278 |
|
| 279 |
+
theme = gr.themes.Soft(primary_hue="rose", secondary_hue="violet", neutral_hue="slate")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
|
| 281 |
with gr.Blocks(
|
| 282 |
title="Faster Urdu ASR + LLM Polisher",
|
|
|
|
| 291 |
sources=["upload", "microphone"],
|
| 292 |
type="filepath",
|
| 293 |
label="Upload or Record Audio",
|
| 294 |
+
# Hide extra transport UI to avoid βdouble playβ feeling
|
| 295 |
+
waveform_options={"show_controls": False},
|
| 296 |
+
autoplay=False,
|
| 297 |
+
streaming=False,
|
| 298 |
)
|
| 299 |
|
| 300 |
with gr.Accordion("Transcription Settings", open=False):
|