kingabzpro commited on
Commit
2bccd97
Β·
verified Β·
1 Parent(s): 5606855

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -20
app.py CHANGED
@@ -1,4 +1,4 @@
1
- # app.py – Faster Urdu ASR + LLM Polisher (right-side output, themed UI, unified audio, LLM self-test)
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, themed, single audio widget, no double play)
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
- # Avoid duplicate control bars: show a single, minimal player
308
- show_label=True,
309
- # In Gradio 5, controlling the player UI is done via waveform_options:
310
- waveform_options={"show_controls": False}, # hide extra transport controls
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):