Commit ·
cbde17a
1
Parent(s): e0a096c
updates
Browse files- Dockerfile +18 -0
- README.md +79 -0
- main.py +3 -1
- requirements.txt +4 -0
Dockerfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# Install system dependencies if any
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
curl \
|
| 6 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
+
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
# Copy requirements and install python dependencies
|
| 11 |
+
COPY requirements.txt .
|
| 12 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
+
|
| 14 |
+
# Copy all codebase files
|
| 15 |
+
COPY . .
|
| 16 |
+
|
| 17 |
+
# Run the FastAPI app
|
| 18 |
+
CMD ["python", "main.py"]
|
README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Grid Royale
|
| 3 |
+
emoji: ⚔️
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 8000
|
| 8 |
+
pinned: false
|
| 9 |
+
tags:
|
| 10 |
+
- build-small
|
| 11 |
+
- track:wood
|
| 12 |
+
- sponsor:modal
|
| 13 |
+
- achievement:offbrand
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# ⚔️ Grid Royale — AI Spectator Battle Royale Arena
|
| 17 |
+
|
| 18 |
+
**Grid Royale** is a premium, esports-themed spectator dashboard and 3D simulation where 8 autonomous AI agents (powered by small LLMs) fight for survival on a grid board.
|
| 19 |
+
|
| 20 |
+
This project is built and submitted as part of the Hugging Face × Gradio **Build Small Hackathon** (June 2026).
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## 🔗 Submission Details
|
| 25 |
+
* **Demo Video:** *[Insert Link to Demo Video]*
|
| 26 |
+
* **Social Post:** *[Insert Link to Social Post (e.g. X/Twitter or LinkedIn)]*
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## 🧠 Core Concept
|
| 31 |
+
Grid Royale is a spectator-first battle royale arena. You configure the grid size, chest counts, game turn limits, and **customize individual agent system prompts** (e.g., teaching them specific behaviors, aggression levels, or defensive strategies) right from the lobby UI. Once deployed, the agents make autonomous decisions (observe, move, attack, dash, shield, heal) on every turn using their LLM brain.
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## 🛠️ Tech Stack & Model Size
|
| 36 |
+
* **Front-End UI**: Dynamic, dark cyberpunk spectator dashboard styled with vanilla CSS glassmorphism and animated with Three.js (WebGL) for smooth, premium 3D graphics.
|
| 37 |
+
* **Back-End API**: FastAPI and Uvicorn server, providing JSON endpoints for game startup, state polling, and turning actions.
|
| 38 |
+
* **LLM Inference**: Powered by the **google/gemma-4-26B-A4B-it** open-weight model (26B parameters, fitting strictly under the hackathon's ≤32B cap).
|
| 39 |
+
* **Compute Platform**: Served serverless on **Modal** (`modal_vllm.py`) for ultra-low latency, scalable GPU inference.
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## 🏆 Hackathon Tracks & Badges Target
|
| 44 |
+
By deploying this Space, we are entering the following categories:
|
| 45 |
+
* **`track:wood` (Thousand Token Wood)**: A whimsical, gamified, and highly visual spectator battle royale.
|
| 46 |
+
* **`sponsor:modal` (Best Use of Modal)**: Uses the serverless Modal platform to run the gemma-4-26B-A4B-it model for agent decision-making.
|
| 47 |
+
* **`achievement:offbrand` (Off-Brand UI)**: Features a fully custom HTML/Three.js WebGL dashboard, bypassing the stock Gradio component UI to look like a real esports broadcast.
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## 🚀 How to Run Locally
|
| 52 |
+
|
| 53 |
+
### 1. Set Up Environment Variables
|
| 54 |
+
Ensure you have the Hugging Face/OpenAI credentials set in your terminal:
|
| 55 |
+
```bash
|
| 56 |
+
export OPENAI_API_KEY="your-key-here"
|
| 57 |
+
export OPENAI_API_BASE="your-modal-endpoint-here"
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
### 2. Install Dependencies
|
| 61 |
+
```bash
|
| 62 |
+
pip install -r requirements.txt
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### 3. Launch App
|
| 66 |
+
```bash
|
| 67 |
+
python main.py
|
| 68 |
+
```
|
| 69 |
+
Open [http://localhost:8000](http://localhost:8000) in your browser.
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## 📦 How to Submit to Hugging Face Spaces
|
| 74 |
+
|
| 75 |
+
1. **Join the Org**: Join the official [Build Small Hackathon organization](https://huggingface.co/build-small-hackathon) on Hugging Face.
|
| 76 |
+
2. **Create a Space**: Create a new Space under the `build-small-hackathon` namespace.
|
| 77 |
+
* **SDK**: Select **Docker** (it will read our `Dockerfile` and `requirements.txt`).
|
| 78 |
+
3. **Upload Repository**: Push this repository to the created Space.
|
| 79 |
+
4. **Add Links**: Update this `README.md` in the Space with your demo video and social post links.
|
main.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import uvicorn
|
| 2 |
from fastapi.staticfiles import StaticFiles
|
| 3 |
from api import app
|
|
@@ -5,4 +6,5 @@ from api import app
|
|
| 5 |
app.mount("/", StaticFiles(directory="frontend/static", html=True), name="frontend")
|
| 6 |
|
| 7 |
if __name__ == "__main__":
|
| 8 |
-
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
import uvicorn
|
| 3 |
from fastapi.staticfiles import StaticFiles
|
| 4 |
from api import app
|
|
|
|
| 6 |
app.mount("/", StaticFiles(directory="frontend/static", html=True), name="frontend")
|
| 7 |
|
| 8 |
if __name__ == "__main__":
|
| 9 |
+
port = int(os.environ.get("PORT", 8000))
|
| 10 |
+
uvicorn.run(app, host="0.0.0.0", port=port)
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi>=0.100.0
|
| 2 |
+
uvicorn>=0.20.0
|
| 3 |
+
pydantic>=2.0
|
| 4 |
+
openai>=1.0.0
|