gxurxv commited on
Commit
d19ccd7
·
verified ·
1 Parent(s): 2f738ef

upload readme

Browse files
Files changed (1) hide show
  1. README.md +13 -36
README.md CHANGED
@@ -1,36 +1,13 @@
1
- # 🤗 Spaces Scheduler
2
-
3
- > Please note, this mechanism has been optimized as a runtime solution. Whilst the core methodology remains viable, there is a more elegant way to implement this feature according to [this template](https://huggingface.co/spaces/davanstrien/restart/blob/main/app.py).
4
-
5
- [Hugging Face Spaces](https://huggingface.co/spaces) offer a simple way to host ML apps directly on the Hugging Face platform.
6
-
7
- The [MPEP initiative](https://github.com/huggingface/data-is-better-together/tree/main/prompt_translation), a part of the [DIBT project](https://huggingface.co/DIBT), identifed a use case wherein it would be desireable to have performance dashboards hosted in Spaces refresh on a schedule.
8
-
9
- Efforts to build a `BackgroundScheduler()` function in the Gradio app proved [imperfect](https://github.com/huggingface/data-is-better-together/pull/33).
10
-
11
- This repository is a lightweight scheduler that leverages [GitHub Actions](https://docs.github.com/en/actions) to externally trigger dashboard rebuild and by extension, data update.
12
-
13
- It may be generalized to induce refresh of arbitrary Hugging Face Spaces.
14
-
15
- # Usage
16
-
17
- Follow these instructions to schedule automated rebuilds of your Hugging Face Space. You need to update the repository to point to the target Space and provide a Hugging Face `write` token.
18
-
19
- 1. To get started, fork or clone this repository to your own GitHub account.
20
- 2. Navigate to `/restart_space.py`.
21
- 3. Refer to `restart_space()` function:
22
-
23
- ```python
24
- def restart_space():
25
- token = os.environ['HF_TOKEN'] # Please navigate to Settings > Secrets and variables > Actions and define "HF_TOKEN".
26
- repo_id = "DIBT-Russian/MPEP_Dashboard" # Please replace this value with the name of your own Hugging Face Space.
27
- ```
28
-
29
- 4. Modify `DIBT-Russian/MPEP_Dashbaord` to point to your Hugging Face Space using the syntax `{{USER OR ORGANIZATION}}/{{SPACE}}`.
30
- 5. In the Repository Menu, follow the path `Settings > Secrets and keys > Actions`.
31
- 6. On the Secrets tab, click New repository secret.
32
- 7. Create a new repository secret called `HF_KEY`.
33
- 8. Provide a [Hugging Face token](https://huggingface.co/settings/tokens) with `write` access from the account which owns the target Space.
34
- 9. Navigate to `/.github/workflows/restart_hf_space.yaml`.
35
- 10. Refer to `cron` schedule: `*/30 * * * *` and update it to your desired value. Please note, inducing rebuild too frequently can result in errored builds caused by compute throttling from Hugging Face. On a free-tier Gradio Space, schedule `*/10 * * * *` proved to be too frequent and hanging builds were observed.
36
- 11. Commit your changes and that's it! Your rebuild scheduler is ready to go!
 
1
+ ---
2
+ title: Optimus Metrics
3
+ emoji: 📈
4
+ colorFrom: purple
5
+ colorTo: gray
6
+ sdk: gradio
7
+ sdk_version: 5.5.0
8
+ app_file: app.py
9
+ pinned: true
10
+ license: apache-2.0
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference