# Unexpected delay while building Gradio server

**URL:** <https://discuss.huggingface.co/t/unexpected-delay-while-building-gradio-server/151592>\
**Category:** Spaces\
**Created:** [April 21, 2025, 11:07am UTC](https://discuss.huggingface.co/t/unexpected-delay-while-building-gradio-server/151592 "2025-04-21T11:07:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [April 21, 2025, 11:37am UTC](https://discuss.huggingface.co/t/unexpected-delay-while-building-gradio-server/151592/2 "2025-04-21T11:37:37Z")

</div>

> [@Issue with FlaskAPI in a Private Space After Sleeping Mode](https://discuss.huggingface.co/t/issue-with-flaskapi-in-a-private-space-after-sleeping-mode/147150):
>
> Hey everyone, I’m facing an issue with my FlaskAPI running in a private Hugging Face Space. I’ve set the space to enter sleeping mode after some time to save resources. However, when I try to wake it up after a few hours by sending a GET/POST request, I get a 404 error. I suspect this might be related to the spaces-jwt token refreshing periodically. I found this thread discussing JWT expiration settings: [https://discuss.huggingface.co/t/how-to-modify-the-fastapi-jwt-token-expiration-setting-i…](https://discuss.huggingface.co/t/how-to-modify-the-fastapi-jwt-token-expiration-setting-issued-by-huggingface/78593)

I think there may be a bug in Spaces’ sleep mode…

> 2

Maybe no.

> 1

It may be possible to configure this via Python, regardless of whether it is paid or free.

> **[Manage your Space](https://huggingface.co/docs/huggingface_hub/guides/manage-spaces)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> Put your Space to sleep after 1h of inactivity  
> api.set\_space\_sleep\_time(repo\_id=repo\_id, sleep\_time=3600)

---

_[View the full topic](https://discuss.huggingface.co/t/unexpected-delay-while-building-gradio-server/151592)._
