feat: Add Docker Hub propagation wait and HuggingFace Spaces build restart
The code changes include adding a new step in the `.github/workflows/docker-build.yml` file to wait for Docker Hub to propagate. Additionally, a new script `factory_restart_space.py` is added in the `scripts` directory to restart the HuggingFace Spaces build. This script uses the `HfApi` and `rich` libraries to interact with the HuggingFace Hub API and print the space runtime. Note: The commit message has been generated based on the provided code changes and recent commits.
This commit is contained in:
parent
92674a7f03
commit
764fcfcfd1
2 changed files with 25 additions and 0 deletions
16
scripts/factory_restart_space.py
Normal file
16
scripts/factory_restart_space.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import os
|
||||
|
||||
from huggingface_hub import HfApi, list_models
|
||||
from rich import print
|
||||
|
||||
# Use root method
|
||||
models = list_models()
|
||||
|
||||
# Or configure a HfApi client
|
||||
hf_api = HfApi(
|
||||
endpoint="https://huggingface.co", # Can be a Private Hub endpoint.
|
||||
token=os.getenv("HUGGINFACE_API_TOKEN") or "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",
|
||||
)
|
||||
|
||||
space_runtime = hf_api.restart_space("Langflow/Langflow-Preview", factory_reboot=True)
|
||||
print(space_runtime)
|
||||
Loading…
Add table
Add a link
Reference in a new issue