Tighten Dream QA ASR feedback timeout
#47
by ADJCJH - opened
- app.py +2 -1
- dream_customs/ui/app.py +2 -2
- tests/test_ui_actions.py +3 -2
app.py
CHANGED
|
@@ -15,7 +15,7 @@ from dream_customs.ui.app import build_demo
|
|
| 15 |
|
| 16 |
LOCAL_GRADIO_PORT = 7862
|
| 17 |
HF_SPACE_GRADIO_PORT = 7860
|
| 18 |
-
BROWSER_ASR_TIMEOUT_SECONDS =
|
| 19 |
|
| 20 |
|
| 21 |
def _default_server_port() -> int:
|
|
@@ -43,6 +43,7 @@ def _browser_asr_client() -> HostedASRClient:
|
|
| 43 |
endpoint=resolved["asr_endpoint"],
|
| 44 |
token=resolved["hosted_token"],
|
| 45 |
timeout=resolved["asr_timeout_seconds"],
|
|
|
|
| 46 |
fallback_enabled=False,
|
| 47 |
)
|
| 48 |
|
|
|
|
| 15 |
|
| 16 |
LOCAL_GRADIO_PORT = 7862
|
| 17 |
HF_SPACE_GRADIO_PORT = 7860
|
| 18 |
+
BROWSER_ASR_TIMEOUT_SECONDS = 9.0
|
| 19 |
|
| 20 |
|
| 21 |
def _default_server_port() -> int:
|
|
|
|
| 43 |
endpoint=resolved["asr_endpoint"],
|
| 44 |
token=resolved["hosted_token"],
|
| 45 |
timeout=resolved["asr_timeout_seconds"],
|
| 46 |
+
latency_budget_ms=resolved["asr_latency_budget_ms"],
|
| 47 |
fallback_enabled=False,
|
| 48 |
)
|
| 49 |
|
dream_customs/ui/app.py
CHANGED
|
@@ -176,7 +176,7 @@ VOICE_JS = r"""
|
|
| 176 |
form.append("audio", blob, `dream-voice.${extension}`);
|
| 177 |
clearRequestTimers();
|
| 178 |
const controller = new AbortController();
|
| 179 |
-
const asrRequestTimeout = Number(button.dataset.timeoutMs || "
|
| 180 |
wakingTimer = window.setTimeout(() => {
|
| 181 |
setStatus(messageFor("waking", "MiMo ASR is waking on Modal. This first pass can take a moment."), "waking");
|
| 182 |
}, 6000);
|
|
@@ -919,7 +919,7 @@ def _mic_html(language: str = DEFAULT_LANGUAGE) -> str:
|
|
| 919 |
data-empty="{escape(copy['mic_empty'])}"
|
| 920 |
data-error="{escape(copy['mic_error'])}"
|
| 921 |
data-timeout="{escape(copy['mic_timeout'])}"
|
| 922 |
-
data-timeout-ms="
|
| 923 |
>
|
| 924 |
<span class="dc-mic-glyph" aria-hidden="true"></span>
|
| 925 |
</button>
|
|
|
|
| 176 |
form.append("audio", blob, `dream-voice.${extension}`);
|
| 177 |
clearRequestTimers();
|
| 178 |
const controller = new AbortController();
|
| 179 |
+
const asrRequestTimeout = Number(button.dataset.timeoutMs || "9000");
|
| 180 |
wakingTimer = window.setTimeout(() => {
|
| 181 |
setStatus(messageFor("waking", "MiMo ASR is waking on Modal. This first pass can take a moment."), "waking");
|
| 182 |
}, 6000);
|
|
|
|
| 919 |
data-empty="{escape(copy['mic_empty'])}"
|
| 920 |
data-error="{escape(copy['mic_error'])}"
|
| 921 |
data-timeout="{escape(copy['mic_timeout'])}"
|
| 922 |
+
data-timeout-ms="{int(DEFAULT_ASR_TIMEOUT_SECONDS * 1000)}"
|
| 923 |
>
|
| 924 |
<span class="dc-mic-glyph" aria-hidden="true"></span>
|
| 925 |
</button>
|
tests/test_ui_actions.py
CHANGED
|
@@ -71,8 +71,9 @@ def test_browser_voice_uses_same_origin_asr_proxy():
|
|
| 71 |
assert "_browser_asr_client()" in source
|
| 72 |
assert "fallback_enabled=False" in source
|
| 73 |
assert "asyncio.to_thread(asr_client.transcribe, temp_path)" in source
|
| 74 |
-
assert "BROWSER_ASR_TIMEOUT_SECONDS =
|
| 75 |
-
assert '
|
|
|
|
| 76 |
assert "DREAM_CUSTOMS_HOSTED_TOKEN" not in source
|
| 77 |
|
| 78 |
|
|
|
|
| 71 |
assert "_browser_asr_client()" in source
|
| 72 |
assert "fallback_enabled=False" in source
|
| 73 |
assert "asyncio.to_thread(asr_client.transcribe, temp_path)" in source
|
| 74 |
+
assert "BROWSER_ASR_TIMEOUT_SECONDS = 9.0" in source
|
| 75 |
+
assert 'latency_budget_ms=resolved["asr_latency_budget_ms"]' in source
|
| 76 |
+
assert 'data-timeout-ms="9000"' in ui_app._mic_html("en")
|
| 77 |
assert "DREAM_CUSTOMS_HOSTED_TOKEN" not in source
|
| 78 |
|
| 79 |
|