mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-23 11:39:17 +08:00
Automatically restart spaces if they're down (#2405)
* check and restart spaces that are down * if no auth_token, don't break build * add to changelog * Update CHANGELOG.md
This commit is contained in:
parent
1dd4d34933
commit
ad2c0790b4
@ -25,6 +25,7 @@ No changes to highlight.
|
||||
* When an `Image` component is set to `source="upload"`, it is now possible to drag and drop and image to replace a previously uploaded image by [@pngwn](https://github.com/pngwn) in [PR 2400](https://github.com/gradio-app/gradio/pull/2410)
|
||||
* Improve documentation of the `Blocks.load()` event by [@abidlabs](https://github.com/abidlabs) in [PR 2413](https://github.com/gradio-app/gradio/pull/2413)
|
||||
* Decreased latency in iterative-output demos by making the iteration asynchronous [@freddyaboulton](https://github.com/freddyaboulton) in [PR 2409](https://github.com/gradio-app/gradio/pull/2409)
|
||||
* Automatically restart spaces if they're down by [@aliabd](https://github.com/aliabd) in [PR 2405](https://github.com/gradio-app/gradio/pull/2405)
|
||||
|
||||
## Contributors Shoutout:
|
||||
No changes to highlight.
|
||||
|
10
website/homepage/src/demos/restart_demos.py
Normal file
10
website/homepage/src/demos/restart_demos.py
Normal file
@ -0,0 +1,10 @@
|
||||
from upload_demos import demos_by_category, upload_demo_to_space, AUTH_TOKEN, gradio_version
|
||||
from gradio.networking import url_ok
|
||||
|
||||
|
||||
for category in demos_by_category:
|
||||
for demo in category["demos"]:
|
||||
space_id = "gradio/" + demo["dir"]
|
||||
if not url_ok(f"https://hf.space/embed/{space_id}/+"):
|
||||
print(f"{space_id} was down, restarting")
|
||||
upload_demo_to_space(demo_name=demo["dir"], space_id=space_id, hf_token=AUTH_TOKEN, gradio_version=gradio_version)
|
@ -67,8 +67,10 @@ def upload_demo_to_space(
|
||||
)
|
||||
return f"https://huggingface.co/spaces/{space_id}"
|
||||
|
||||
for category in demos_by_category:
|
||||
for demo in category["demos"]:
|
||||
space_id = "gradio/" + demo["dir"]
|
||||
upload_demo_to_space(demo_name=demo["dir"], space_id=space_id, hf_token=AUTH_TOKEN, gradio_version=gradio_version)
|
||||
if __name__ == "__main__":
|
||||
if AUTH_TOKEN is not None:
|
||||
for category in demos_by_category:
|
||||
for demo in category["demos"]:
|
||||
space_id = "gradio/" + demo["dir"]
|
||||
upload_demo_to_space(demo_name=demo["dir"], space_id=space_id, hf_token=AUTH_TOKEN, gradio_version=gradio_version)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user