# Can't get Zero-GPU to work with Fastapi/Uvicorn

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-get-zero-gpu-to-work-with-fastapi-uvicorn%2F141634%3E%5C
**Category:** Spaces\
**Created:** [February 18, 2025, 4:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-get-zero-gpu-to-work-with-fastapi-uvicorn%2F141634 "2025-02-18T16:53:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m7n](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@m7n](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fm7n)%5C
**Post date:** [February 18, 2025, 4:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-get-zero-gpu-to-work-with-fastapi-uvicorn%2F141634%2F1 "2025-02-18T16:53:51Z")

</div>

Hello everyone – I’d really like to use ZeroGPU for my project, but I just can’t get it to work for my use-case, and have been working on it for days now. Basically the issue is:

ZeroGPU only works for me when I enable SSR-mode in Gradio 5.+. If I don’t do that I’m running into all the issues about ZeroGPU not finding the account of the user, and applying the very restrictive IP-based limits, which have been discussed in this forum. That wouldn’t be a problem, but I need to server my application through FastAPI with Uvicorn, because this is the only approach that allows me to make dynamically created html-files available to the users. Unfortunately, this configuration causes the space to break on all browsers I tried, which looks like this:

 ![Screenshot 2025-02-15 at 00.55.42.png](https://us1.discourse-cdn.com/hellohellohello/original/3X/8/e/8e66a1e9d7342b183f22fbce2840246ca42af36e.png)

If I disable SSR, Zero GPU stops working, if I enable it, the space breaks.  
I’ve built a little example space to demonstrate the problem:  
[https://huggingface.co/spaces/m7n/zero\_gpu\_uvicorn\_ssr\_example?logs=build](https://huggingface.co/spaces/m7n/zero_gpu_uvicorn_ssr_example?logs=build)

I’d be really appreciative of any pointers on how to get this to work, it’s driving me crazy!

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [February 18, 2025, 6:05pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-get-zero-gpu-to-work-with-fastapi-uvicorn%2F141634%2F2 "2025-02-18T18:05:21Z")

</div>

This is similar to this case, but if this is the case, it cannot be avoided by the user…

> <https://github.com/gradio-app/gradio/issues/10050>
>
> \### Describe the bug
> 
> It looks like not all assets are loaded from the proper di…rectory when Gradio is mounted with FastAPI with some path. For example, for the default theme (when app is mounted to \`/xyz\`) it misses \`/assets/index-Bmd1Nf3q.css\`, while file \`/xyz/assets/index-Bmd1Nf3q.css\` is available (example in the logs below).
> 
> Much more files are missed for the other themes. I tested \`gr.themes.Default()\`, \`gr.themes.Base()\`, \`gr.themes.Soft()\`, and \`gr.themes.Glass()\`. Due to these issues progressing animation is not showed, and may be some other details are displayed not properly.
> 
> It may be the same as https://github.com/gradio-app/gradio/issues/8073, but I don't use NGINX or HTTPS.
> 
> \### Have you searched existing issues? 🔎
> 
> \- \[X\] I have searched and found no existing issues
> 
> \### Reproduction
> 
> \`\`\`python
> import gradio as gr
> import uvicorn
> from fastapi import FastAPI
> 
> app = FastAPI(docs\_url=None, redoc\_url=None)
> 
> with gr.Blocks(
> theme=gr.themes.Default(text\_size='md'), analytics\_enabled=False, title="Test"
> ) as gr\_io:
> with gr.Row():
> gr.Markdown(value="Description", line\_breaks=False)
> with gr.Row():
> with gr.Column():
> with gr.Row():
> grc\_submit\_btn = gr.Button(
> value="GO",
> variant='primary',
> )
> with gr.Column(variant='panel'):
> grc\_result\_area = gr.Markdown(value="")
> with gr.Row():
> gr.Markdown(value="Extra note", line\_breaks=False)
> 
> app = gr.mount\_gradio\_app(app, gr\_io, path='/xyz')
> 
> uvicorn.run(app, host='0.0.0.0', port=config.server\_internal\_port)
> \`\`\`
> 
> 
> \### Screenshot
> 
> \_No response\_
> 
> \### Logs
> 
> \`\`\`shell
> INFO: 10.1.243.1:38230 - "GET /xyz/ HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/index-Dj1xzGVg.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/index-Bmd1Nf3q.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/svelte/svelte.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Index-yDh-RRa8.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Embed-Dgos\_deE.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/index-CAS\_VNRG.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38258 - "GET /xyz/assets/StreamingBar.svelte\_svelte\_type\_style\_lang-CxOfZBE-.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/IconButtonWrapper.svelte\_svelte\_type\_style\_lang-DAP8\_Zsr.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/MarkdownCode.svelte\_svelte\_type\_style\_lang-CRfeLYV9.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/prism-python-VskFp\_Cc.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/IconButton-DtUbToT-.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38258 - "GET /xyz/assets/Clear-By3xiIwg.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/context-TgWPFwN2.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/StreamingBar-DPKKRe-n.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/IconButtonWrapper-6oLg\_adW.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38258 - "GET /xyz/assets/MarkdownCode-DfnQ3ojf.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Index-BJ\_RfjVB.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/DownloadLink-CqD3Uu0l.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /favicon.ico HTTP/1.1" 404 Not Found
> INFO: 10.1.243.1:38258 - "GET /assets/index-Bmd1Nf3q.css HTTP/1.1" 404 Not Found
> INFO: 10.1.243.1:38244 - "GET /xyz/theme.css?v=76ee63afdb6c2791ddf9b92428cb796885031b4a4f1259df434def0a7c3f9d63 HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38258 - "GET /xyz/gradio\_api/heartbeat/6bmuowsl0i HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Blocks-2mhBL-Wz.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Button-Dn54xFln.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Block-rEXcgPfT.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Toast-CGNhF\_fW.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/index-Dqmuz79m.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/utils-BsGrhMNe.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Button-C-VfIjPJ.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Blocks-yLdzXwzS.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/static/fonts/ui-sans-serif/ui-sans-serif-Regular.woff2 HTTP/1.1" 404 Not Found
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Index-BWsGP2Ue.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Index-BGB95BqN.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Index-Cknuz4Hv.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Check-BiRlaMNo.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Copy-CxQ9EyK2.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/MarkdownCode-UKT7Q0jB.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/IconButtonWrapper-fdTarNL8.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Example-BsK0JilY.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Index-B8brEV0q.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Index-B630uaPU.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Tabs-CemoFNU3.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Index-WEzAIkMk.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Index-BaQTPtXo.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/FileUpload-D8-2zX42.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/BlockLabel-CnzaitFN.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Empty-CMV1fpYf.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Upload-DSEEphK\_.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/File-BQ\_9P3Ye.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Upload-DXgDHKDd.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/DownloadLink-IzUam-rM.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/file-url-DgijyRSD.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/UploadText-DnPHeWhE.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Example-DrmWnoSo.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Info-\_kFFYhID.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Index-Danc61\_d.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Index-BLXLQ2B2.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Index-DE1Sah7F.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Textbox-DRR8nyCw.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Send-DyoOovnk.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Square-oAGqOwsh.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Example-DN4wtGrM.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Index-DLT8ABL8.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Index-DV6aCiD8.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Index-BEHDlc0X.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/DropdownArrow-B7m41FWT.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Example-BFOhuzTJ.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Index-dG59Z873.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Index-wLIo4CCP.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/BlockTitle-BOkEQEU6.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Index-CptIZeFZ.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Example-D7K5RtQ2.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Index-7U9UAML0.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Tabs-C0qLuAtA.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Index-BcNLXLca.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/FileUpload-2TE7T7kD.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Index-Cgj6KPvj.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Upload-A42O3qlm.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Example-DpWs9cEC.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Index-DMKGW8pW.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Index-12OnbRhk.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Textbox-jWD3sCxr.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38230 - "GET /xyz/assets/Example-Cj3ii62O.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Index-CWxB-qJp.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/assets/Index-Dclo02rM.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38268 - "GET /xyz/assets/Index-WIAKB-\_s.css HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38244 - "GET /xyz/assets/Index-uRgjJb4U.js HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "POST /xyz/gradio\_api/queue/join HTTP/1.1" 200 OK
> INFO: 10.1.243.1:38236 - "GET /xyz/gradio\_api/queue/data?session\_hash=6bmuowsl0i HTTP/1.1" 200 OK
> \`\`\`
> 
> 
> \### System Info
> 
> \`\`\`shell
> Gradio Environment Information:
> \------------------------------
> Operating System: Linux
> gradio version: 5.6.0
> gradio\_client version: 1.4.3
> 
> \------------------------------------------------
> gradio dependencies in your environment:
> 
> aiofiles: 23.2.1
> anyio: 4.6.2.post1
> audioop-lts is not installed.
> fastapi: 0.115.5
> ffmpy: 0.4.0
> gradio-client==1.4.3 is not installed.
> httpx: 0.27.2
> huggingface-hub: 0.26.2
> jinja2: 3.1.4
> markupsafe: 2.1.5
> numpy: 1.26.4
> orjson: 3.10.12
> packaging: 24.2
> pandas: 2.2.3
> pillow: 11.0.0
> pydantic: 2.10.2
> pydub: 0.25.1
> python-multipart==0.0.12 is not installed.
> pyyaml: 6.0.2
> ruff: 0.8.0
> safehttpx: 0.1.1
> semantic-version: 2.10.0
> starlette: 0.41.3
> tomlkit==0.12.0 is not installed.
> typer: 0.13.1
> typing-extensions: 4.12.2
> urllib3: 2.2.3
> uvicorn: 0.32.1
> authlib; extra == 'oauth' is not installed.
> itsdangerous; extra == 'oauth' is not installed.
> 
> 
> gradio\_client dependencies in your environment:
> 
> fsspec: 2024.10.0
> httpx: 0.27.2
> huggingface-hub: 0.26.2
> packaging: 24.2
> typing-extensions: 4.12.2
> websockets: 12.0
> \`\`\`
> 
> 
> \### Severity
> 
> Blocking usage of gradio

---

<div class="post-metadata">

**Author:** ![m7n](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@m7n](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fm7n)%5C
**Post date:** [February 18, 2025, 6:43pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-get-zero-gpu-to-work-with-fastapi-uvicorn%2F141634%2F3 "2025-02-18T18:43:42Z")

</div>

Hmm. Thank you for the pointer! I’ll take a look.

---

<div class="post-metadata">

**Author:** ![m7n](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@m7n](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fm7n)%5C
**Post date:** [February 18, 2025, 11:20pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-get-zero-gpu-to-work-with-fastapi-uvicorn%2F141634%2F4 "2025-02-18T23:20:22Z")

</div>

Ok, so it seems like this was fixed in the latest gradio release (5.16.1), just a few hours ago. Authentification now works again without ssr: [Steveeeeeeen/Zonos · Fix ZeroGPU auth](https://huggingface.co/spaces/Steveeeeeeen/Zonos/discussions/6)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [February 19, 2025, 11:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-get-zero-gpu-to-work-with-fastapi-uvicorn%2F141634%2F5 "2025-02-19T11:21:08Z")

</div>

Closed on February 19, 2025, 11:21am UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
