Spaces:
Sleeping
Sleeping
Deploy Myco from GitHub Actions
Browse files- README.md +15 -138
- app.py +4 -5
- ui/gradio_app.py +1 -1
README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
---
|
| 2 |
title: Myco
|
| 3 |
emoji: π
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
-
short_description:
|
| 12 |
---
|
| 13 |
|
| 14 |
# π Myco
|
| 15 |
|
| 16 |
-
Myco is a
|
| 17 |
|
| 18 |
**Live Space:** https://huggingface.co/spaces/byte-vortex/Myco
|
| 19 |
|
|
@@ -25,82 +25,27 @@ Myco is a small Gradio game for Hugging Face Spaces. Explore a cozy forest with
|
|
| 25 |
4. Choose **Study**, **Collect**, or **Eat**.
|
| 26 |
5. Build your **MycoDex** and unlock forest progress.
|
| 27 |
|
| 28 |
-
##
|
| 29 |
-
|
| 30 |
-
- Gradio app entrypoint: `app.py`
|
| 31 |
-
- UI code: `ui/`
|
| 32 |
-
- Game logic: `game/`
|
| 33 |
-
- Mushroom model: `models/`
|
| 34 |
-
- Mushroom catalog: `data/mushrooms.json`
|
| 35 |
-
- Runtime dependency: `requirements.txt`
|
| 36 |
-
|
| 37 |
-
## Local development
|
| 38 |
-
|
| 39 |
-
```bash
|
| 40 |
-
Myco is a cozy exploration game prototype for Gradio + Hugging Face Spaces. Myco, an AI mushroom companion, helps players discover strange fungi in a magical forest and collect them in a MycoDex.
|
| 41 |
-
|
| 42 |
-
## First 60 Seconds
|
| 43 |
-
|
| 44 |
-
1. Open the game.
|
| 45 |
-
2. Meet Myco: "Hello! I'm Myco. Let's explore the forest."
|
| 46 |
-
3. Click **Start Exploring**.
|
| 47 |
-
4. Discover a mushroom, such as **Glowcap**.
|
| 48 |
-
5. Ask Myco about it.
|
| 49 |
-
6. Decide whether to **Eat**, **Collect**, or **Study**.
|
| 50 |
-
7. Add it to the **MycoDex** and watch forest goals progress.
|
| 51 |
-
|
| 52 |
-
## Hackathon MVP
|
| 53 |
|
| 54 |
- Polished forest-themed hero panel with Myco mascot
|
| 55 |
-
-
|
| 56 |
-
-
|
| 57 |
-
- Myco chat panel
|
| 58 |
- Eat, Collect, and Study choices
|
| 59 |
-
- MycoDex collection
|
| 60 |
-
- Forest progression goals
|
| 61 |
-
- 30 starter mushroom species
|
| 62 |
- Common, Rare, and Legendary rarity tiers
|
| 63 |
|
| 64 |
-
The MVP intentionally skips combat, multiplayer, and a huge map so the first playable loop can feel polished instead of oversized.
|
| 65 |
-
|
| 66 |
-
3. Click **Explore**.
|
| 67 |
-
4. Discover a mushroom, such as **Glowcap**.
|
| 68 |
-
5. Ask Myco about it.
|
| 69 |
-
6. Add it to the **MycoDex**.
|
| 70 |
-
|
| 71 |
-
## Hackathon MVP
|
| 72 |
-
|
| 73 |
-
- Explore button
|
| 74 |
-
- Mushroom discovery
|
| 75 |
-
- Myco chat panel
|
| 76 |
-
- MycoDex collection
|
| 77 |
-
- 30 starter mushroom species
|
| 78 |
-
- Common, Rare, and Legendary rarity tiers
|
| 79 |
-
|
| 80 |
-
The MVP intentionally skips combat, multiplayer, and a huge map so the first playable loop is clear and achievable.
|
| 81 |
-
|
| 82 |
## Project Structure
|
| 83 |
|
| 84 |
```text
|
| 85 |
-
hf-gradio-small-hackathon-myco/
|
| 86 |
βββ app.py
|
| 87 |
βββ requirements.txt
|
| 88 |
-
βββ .gitignore
|
| 89 |
-
βββ assets/
|
| 90 |
-
β βββ images/
|
| 91 |
-
β βββ sounds/
|
| 92 |
βββ data/
|
| 93 |
βββ game/
|
| 94 |
βββ models/
|
| 95 |
-
|
| 96 |
-
βββ tests/
|
| 97 |
-
βββ CODEx_USAGE.md
|
| 98 |
-
βββ README.md
|
| 99 |
```
|
| 100 |
|
| 101 |
-
`assets/` and `data/` are tracked with placeholder files so art, sounds, and game data have obvious homes. `models/` contains lightweight Python domain models, while heavyweight local model downloads remain ignored by Git through file patterns and `models/downloads/`.
|
| 102 |
-
`assets/` and `data/` are tracked with placeholder files so art, sounds, and game data have obvious homes. `models/` contains lightweight Python domain models, while heavyweight local model downloads happen in `game/`.
|
| 103 |
-
|
| 104 |
## Local Development
|
| 105 |
|
| 106 |
```bash
|
|
@@ -110,80 +55,12 @@ pip install -r requirements.txt
|
|
| 110 |
python app.py
|
| 111 |
```
|
| 112 |
|
| 113 |
-
Then open the local Gradio URL printed in the terminal.
|
| 114 |
-
|
| 115 |
-
## Hugging Face Space
|
| 116 |
-
|
| 117 |
-
This repo is intended to run directly as a Gradio Space. Hugging Face Spaces reads the metadata at the top of this README, installs `requirements.txt`, and runs `app.py`.
|
| 118 |
-
|
| 119 |
-
No GitHub Actions deployment workflow is required. To deploy manually:
|
| 120 |
-
|
| 121 |
-
1. Create or open the Space at https://huggingface.co/spaces/byte-vortex/Myco.
|
| 122 |
-
2. Make sure the Space SDK is **Gradio**.
|
| 123 |
-
3. Upload or push this repository's files to the Space repository.
|
| 124 |
-
4. The Space should install `gradio==6.16.0` from `requirements.txt` and start from `app.py`.
|
| 125 |
-
|
| 126 |
-
The required runtime files are `README.md`, `app.py`, `requirements.txt`, `data/`, `game/`, `models/`, and `ui/`.
|
| 127 |
-
**Live Space:** https://huggingface.co/spaces/byte-vortex/Myco
|
| 128 |
-
|
| 129 |
-
**GitHub repository:** https://github.com/YOUR_USERNAME/hf-gradio-small-hackathon-myco
|
| 130 |
-
|
| 131 |
-
Replace `YOUR_USERNAME` with the public GitHub owner before submitting the Space so judges can inspect the Codex-attributed commit history.
|
| 132 |
-
|
| 133 |
-
Create a Gradio Space and include these files at the repository root:
|
| 134 |
-
|
| 135 |
-
```text
|
| 136 |
-
README.md
|
| 137 |
-
app.py
|
| 138 |
-
requirements.txt
|
| 139 |
-
.gitignore
|
| 140 |
-
```
|
| 141 |
-
|
| 142 |
-
Hugging Face Spaces will install `requirements.txt` and run `app.py`.
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
### GitHub Actions Workspace Path
|
| 146 |
-
|
| 147 |
-
In GitHub Actions logs, paths often look like `/home/runner/work/hf-gradio-small-hackathon-myco/hf-gradio-small-hackathon-myco/...`. The repository name appears twice because GitHub checks repositories out under `/home/runner/work/<repo>/<repo>/`: the first segment is the workspace folder and the second segment is the actual checkout directory. This is normal and does not mean the project has been duplicated.
|
| 148 |
-
|
| 149 |
-
### GitHub Actions Deployment Token
|
| 150 |
-
|
| 151 |
-
If you use the included deploy workflow, add `HF_BUILD_SMALL_HACKATHON_TOKEN` as a GitHub Actions secret with write access to the Space. The workflow sets `PYTHONPATH=.` so inline Python checks import `sitecustomize.py`, normalizes an empty `HF_BUILD_SMALL_HACKATHON_TOKEN` into `$GITHUB_ENV`, and skips deployment with a warning when the token is empty or missing. This prevents `os.environ["HF_BUILD_SMALL_HACKATHON_TOKEN"]` checks from failing with `KeyError`.
|
| 152 |
-
### GitHub Actions Deployment Token
|
| 153 |
-
|
| 154 |
-
If you use the included deploy workflow, add `HF_BUILD_SMALL_HACKATHON_TOKEN` as a GitHub Actions secret with write access to the Space. The workflow sets `PYTHONPATH=.` so inline Python checks import `sitecustomize.py`, normalizes an empty `HF_BUILD_SMALL_HACKATHON_TOKEN` into `$GITHUB_ENV`, and skips deployment with a warning when the token is empty or missing. This prevents `os.environ["HF_BUILD_SMALL_HACKATHON_TOKEN"]` checks from failing with `KeyError`.
|
| 155 |
-
If you use the included deploy workflow, add `HF_BUILD_SMALL_HACKATHON_TOKEN` as a GitHub Actions secret with write access to the Space. The workflow defines `HF_BUILD_SMALL_HACKATHON_TOKEN` at workflow scope, so even future inline `python -c` checks can read `os.environ["HF_BUILD_SMALL_HACKATHON_TOKEN"]` without raising `KeyError`; when the secret is empty or missing, deployment is skipped with a warning.
|
| 156 |
-
If you use the included deploy workflow, add `HF_BUILD_SMALL_HACKATHON_TOKEN` as a GitHub Actions secret with write access to the Space. The workflow checks for the secret with `scripts/check_hf_token.py`; when the secret is missing, deployment is skipped with a warning instead of failing with `KeyError: 'HF_BUILD_SMALL_HACKATHON_TOKEN'`.
|
| 157 |
-
|
| 158 |
-
## Future Ideas
|
| 159 |
-
|
| 160 |
-
- More animated Myco mascot states
|
| 161 |
-
## Future Ideas
|
| 162 |
-
|
| 163 |
-
- Mushroom rarity progression
|
| 164 |
-
- Mushroom villages
|
| 165 |
-
- Mushroom recipes
|
| 166 |
-
- Mushroom evolution
|
| 167 |
-
- Generated mushroom art
|
| 168 |
-
- Optional small-model backend such as `gpt-oss-20b`
|
| 169 |
-
|
| 170 |
## Codex Track Notes
|
| 171 |
|
| 172 |
-
This project
|
| 173 |
-
|
| 174 |
-
See [`CODEx_USAGE.md`](CODEx_USAGE.md) for a concise record of how Codex helped shape the app architecture, gameplay loop, refactor, and tests.
|
| 175 |
-
|
| 176 |
-
### Codex PR Workflow
|
| 177 |
-
|
| 178 |
-
If a pull request is changed outside of Codex, create a new Codex PR for follow-up work. This keeps the Codex-attributed development trail clear and avoids trying to update a PR Codex can no longer manage.
|
| 179 |
|
| 180 |
### Submission Checklist
|
| 181 |
|
| 182 |
-
- [ ] Publish
|
| 183 |
-
- [ ]
|
| 184 |
-
- [ ]
|
| 185 |
-
- [ ] Confirm the live Space link works: https://huggingface.co/spaces/byte-vortex/Myco
|
| 186 |
-
- [ ] Deploy the Space and verify the first playable loop: Start Exploring β Ask Myco β Study or Collect β MycoDex progress.
|
| 187 |
-
See [`CODEx_USAGE.md`](CODEx_USAGE.md) for a concise record of how Codex helped shape the app architecture, gameplay loop, refactor, and tests.
|
| 188 |
-
|
| 189 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: Myco
|
| 3 |
emoji: π
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.29.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
short_description: Cozy mushroom exploration game
|
| 12 |
---
|
| 13 |
|
| 14 |
# π Myco
|
| 15 |
|
| 16 |
+
Myco is a cozy forest exploration game built with Gradio for Hugging Face Spaces. Explore a magical forest with Myco, an AI mushroom companion. Discover strange fungi, ask about them, study them, and collect them in your MycoDex.
|
| 17 |
|
| 18 |
**Live Space:** https://huggingface.co/spaces/byte-vortex/Myco
|
| 19 |
|
|
|
|
| 25 |
4. Choose **Study**, **Collect**, or **Eat**.
|
| 26 |
5. Build your **MycoDex** and unlock forest progress.
|
| 27 |
|
| 28 |
+
## Features
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
- Polished forest-themed hero panel with Myco mascot
|
| 31 |
+
- Mushroom discovery with 30 starter species
|
| 32 |
+
- Myco AI chat companion
|
|
|
|
| 33 |
- Eat, Collect, and Study choices
|
| 34 |
+
- MycoDex collection tracker
|
| 35 |
+
- Forest progression goals: Crystal Grove, Moonlit Cavern, and Mushroom Elder
|
|
|
|
| 36 |
- Common, Rare, and Legendary rarity tiers
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
## Project Structure
|
| 39 |
|
| 40 |
```text
|
|
|
|
| 41 |
βββ app.py
|
| 42 |
βββ requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
βββ data/
|
| 44 |
βββ game/
|
| 45 |
βββ models/
|
| 46 |
+
βββ ui/
|
|
|
|
|
|
|
|
|
|
| 47 |
```
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
## Local Development
|
| 50 |
|
| 51 |
```bash
|
|
|
|
| 55 |
python app.py
|
| 56 |
```
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
## Codex Track Notes
|
| 59 |
|
| 60 |
+
This project was built with Codex assistance. See `CODEx_USAGE.md` for a record of how Codex shaped the architecture, gameplay loop, and tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
### Submission Checklist
|
| 63 |
|
| 64 |
+
- [ ] Publish repository on GitHub
|
| 65 |
+
- [ ] Confirm live Space works: https://huggingface.co/spaces/byte-vortex/Myco
|
| 66 |
+
- [ ] Verify first play loop: Start Exploring β Ask Myco β Study or Collect β MycoDex progress
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
"""Hugging Face Spaces entrypoint for Myco."""
|
| 2 |
-
import gradio as gr
|
| 3 |
from ui.gradio_app import build_app
|
| 4 |
|
| 5 |
demo = build_app()
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 1 |
"""Hugging Face Spaces entrypoint for Myco."""
|
|
|
|
| 2 |
from ui.gradio_app import build_app
|
| 3 |
|
| 4 |
demo = build_app()
|
| 5 |
+
|
| 6 |
+
if __name__ == "__main__":
|
| 7 |
+
demo.launch()
|
| 8 |
+
|
ui/gradio_app.py
CHANGED
|
@@ -61,7 +61,7 @@ def mushroom_card_from_state(current: MushroomState | None) -> str:
|
|
| 61 |
|
| 62 |
def build_app() -> gr.Blocks:
|
| 63 |
"""Build the Gradio interface for Hugging Face Spaces."""
|
| 64 |
-
with gr.Blocks(title="Myco") as demo:
|
| 65 |
current_mushroom = gr.State(None)
|
| 66 |
collection = gr.State([])
|
| 67 |
|
|
|
|
| 61 |
|
| 62 |
def build_app() -> gr.Blocks:
|
| 63 |
"""Build the Gradio interface for Hugging Face Spaces."""
|
| 64 |
+
with gr.Blocks(title="Myco", theme=gr.themes.Soft(primary_hue="green", secondary_hue="emerald")) as demo:
|
| 65 |
current_mushroom = gr.State(None)
|
| 66 |
collection = gr.State([])
|
| 67 |
|