Spaces:
Running
Running
Commit History
-
Frontend: DiT calls switch to async job patternβ
callDiTForImage now POSTs /api/generate_image_async, then polls /api/task/{id} every 2s. Bypasses HF's 10-min HTTP/2 keep-alive which was cutting off cold-start (5min model load) responses. Button label updates with elapsed seconds while running. Regenerated static/index.html via build_index.py (which was missing from the Space repo β added it back so redeploys can rebuild the SPA).5768c63 -
PE: SSE streaming (/api/generate_sp/stream) + SPA live token renderβ
- Space: add /api/generate_sp/stream that opens an async httpx stream to the vLLM endpoint with stream=true, relays each token as an SSE 'event: token' frame, then emits 'event: done' with the extracted SP JSON (or raw text on parse failure). Cold-start 503 β 'event: waking' with a retry hint, tries 15x @ 30s. - SPA callLLMForSP: switch from blocking /api/generate_sp to the streaming endpoint. Flips SP editor into raw textarea mode, appends every incoming token, auto-scrolls, and on 'done' returns the parsed SP so setSPContent can populate the structured view.c425f49
-
SPA: null-safe getElementById wrappers for removed UI elementsβ
Removing paramForceT2I / paramDitEndpoint from template.html left syncParamsFromUI / syncParamsToUI reading .checked / .value on null, which crashed the Generate Image click handler. Wrap DOM reads in _valOr / _checkedOr / _setIfExists helpers so a missing element just falls back to the default and the rest of the handler keeps working.6c21b93 -
SPA: fix unescaped apostrophes in single-quoted stringsβ
Two showToast lines had translations with English contractions inside single-quoted JS strings ('isn't', 'Can't'), which broke the entire inline <script> with 'missing ) after argument list' β that in turn made handleGenerateSP/etc. undefined, so button clicks did nothing. Switch those literals to double quotes and rebuild static/index.html.eff812e
-
Switch to FastAPI + SPA + diffusers DiTβ
- app.py: FastAPI serves the SP-editor SPA at /, plus /api/generate_image (DiT via @spaces.GPU with enable_model_cpu_offload for the 48GB MIG slice) and /api/generate_sp (returns 501 with a hint β PE not wired on ZeroGPU yet). - static/: single-page Structured Prompt Studio (English, URL field and Force-T2I removed, refreshed indigo palette). - requirements.txt: drop vllm (incompatible with ZeroGPU + Qwen3.5), add diffusers/accelerate/safetensors/sentencepiece.b5f60e1