Spaces:
Sleeping
Sleeping
Commit History
-
fix: use a plain module-level @spaces.GPU function, not a bound method
Decorating InferenceEngine.run_user_file directly was wrong: ZeroGPU forks a worker process and sends the call's args through a pickled multiprocessing queue. Since it's a bound method, `self` (the whole engine, including the loaded HAT model) got pickled and sent across that boundary. ZeroGPU's disk-offload tracking keys off the *original* tensor objects, so the unpickled copy in the worker was never recognized/materialized onto the GPU — conv2d kept hitting a placeholder tensor, same error as before. Add a plain top-level run_gpu_inference(file_path, model_name) that takes only small picklable arguments and reaches the model through the module-level `inference_engine` global, which the forked worker inherits for free via fork() instead of pickling. Both the Gradio handler and the REST /api/upload endpoint now call this single shared entrypoint (the latter via run_in_threadpool, since it's async and the call blocks on GPU scheduling). Co-Authored-By: Claude Sonnet 5 <noreply@anthrop…8ac6b2e -
fix: decorate InferenceEngine.run_user_file with @spaces.GPU
The REST /api/upload endpoint called inference_engine.run_user_file() directly, outside any @spaces.GPU context. ZeroGPU keeps model weights disk-offloaded until code runs inside a @spaces.GPU-decorated function, so conv2d hit a placeholder tensor: "Cannot apply function ... on disk-offloaded Tensor". Only the Gradio test tab worked, since its handler was separately decorated. Decorate the shared run_user_file method instead of each call site, and drop the now-redundant decorator on the Gradio handler to avoid nesting two ZeroGPU schedule calls in the same request. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>56da09b -
fix: manually trigger ZeroGPU startup handshake for mounted Gradio app
The spaces SDK reports @spaces.GPU functions to HF's ZeroGPU scheduler by monkey-patching gr.Blocks.launch(). This app mounts Gradio into FastAPI via gr.mount_gradio_app() and serves it with a bare uvicorn.run() instead of calling demo.launch(), so that patched hook never fires and the scheduler times out with "No @spaces.GPU function detected". Call spaces.zero.startup() directly after mounting to send the same /startup-report handshake launch() would have triggered. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>a385053 -
fix: import spaces before any CUDA/torch modules for ZeroGPU
059bf81 -
fix: add @spaces.GPU decorator for Hugging Face ZeroGPU compatibility
fd73401 -
fix: disable Gradio SSR mode to prevent port 7861 conflict on HF Spaces
478ede0 -
chore: add app files
7529108