multimodalart HF Staff commited on
Commit
f4fb1be
·
verified ·
1 Parent(s): 3c8c38e

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -46,14 +46,21 @@ STT = EmbeddingGemmaSTT(
46
 
47
 
48
  def _estimate_duration(audio_path, *args, **kwargs):
49
- """Reserve GPU time from the input length (extras swallowed: Gradio injects progress=)."""
 
 
 
 
 
 
 
50
  secs = MAX_SECONDS
51
  if isinstance(audio_path, str) and os.path.exists(audio_path):
52
  try:
53
  secs = sf.info(audio_path).duration
54
  except Exception:
55
  pass
56
- return int(min(90.0, 15.0 + secs * 0.35))
57
 
58
 
59
  @spaces.GPU(duration=_estimate_duration)
@@ -112,7 +119,7 @@ CSS = """
112
  .dark .gradio-container { color: var(--body-text-color); }
113
  """
114
 
115
- with gr.Blocks(theme=gr.themes.Citrus(), css=CSS) as demo:
116
  with gr.Column(elem_id="col-container"):
117
  gr.Markdown(
118
  "# Notesoop-STT-Ko-v1 — Korean Speech Recognition\n"
@@ -177,4 +184,9 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=CSS) as demo:
177
  )
178
 
179
  if __name__ == "__main__":
180
- demo.launch(mcp_server=True)
 
 
 
 
 
 
46
 
47
 
48
  def _estimate_duration(audio_path, *args, **kwargs):
49
+ """Reserve GPU time from the input length (extras swallowed: Gradio injects progress=).
50
+
51
+ Measured on ZeroGPU (zero-a10g): 5.4 s of audio -> 0.42 s, 6.9 s -> 1.27 s,
52
+ 44.7 s -> 1.18 s and the 180 s cap -> 5.46 s of actual compute, plus roughly
53
+ 0.4 s of per-request worker overhead in steady state. 2 s + 0.05 s per audio
54
+ second (floored at 6 s so a cold worker still fits) tracks that with a
55
+ comfortable margin without wasting visitor quota.
56
+ """
57
  secs = MAX_SECONDS
58
  if isinstance(audio_path, str) and os.path.exists(audio_path):
59
  try:
60
  secs = sf.info(audio_path).duration
61
  except Exception:
62
  pass
63
+ return max(6, min(18, int(round(2.0 + secs * 0.05))))
64
 
65
 
66
  @spaces.GPU(duration=_estimate_duration)
 
119
  .dark .gradio-container { color: var(--body-text-color); }
120
  """
121
 
122
+ with gr.Blocks() as demo:
123
  with gr.Column(elem_id="col-container"):
124
  gr.Markdown(
125
  "# Notesoop-STT-Ko-v1 — Korean Speech Recognition\n"
 
184
  )
185
 
186
  if __name__ == "__main__":
187
+ demo.launch(
188
+ theme=gr.themes.Citrus(),
189
+ css=CSS,
190
+ mcp_server=True,
191
+ allowed_paths=[os.path.join(APP_DIR, "examples")],
192
+ )