Spaces:
Sleeping
Sleeping
Commit ·
cc5da55
1
Parent(s): e6da486
added dockerfile and updated readme for hf deployment
Browse files- Dockerfile +25 -0
- README.md +30 -3
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Root-level Dockerfile for Hugging Face Spaces deployment.
|
| 2 |
+
# HF Spaces (Docker SDK) requires the Dockerfile at the repo root.
|
| 3 |
+
ARG BASE_IMAGE=python:3.13-slim
|
| 4 |
+
FROM ${BASE_IMAGE}
|
| 5 |
+
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
|
| 8 |
+
# Install uv
|
| 9 |
+
RUN pip install uv --no-cache-dir
|
| 10 |
+
|
| 11 |
+
# Copy project files
|
| 12 |
+
COPY pyproject.toml uv.lock* ./
|
| 13 |
+
COPY models.py client.py __init__.py baseline.py openenv.yaml ./
|
| 14 |
+
COPY server/ ./server/
|
| 15 |
+
COPY tasks/ ./tasks/
|
| 16 |
+
COPY datasets/ ./datasets/
|
| 17 |
+
|
| 18 |
+
# Install dependencies
|
| 19 |
+
RUN uv sync --frozen --no-dev
|
| 20 |
+
|
| 21 |
+
# HF Spaces runs containers as a non-root user on port 7860
|
| 22 |
+
ENV PORT=7860
|
| 23 |
+
EXPOSE 7860
|
| 24 |
+
|
| 25 |
+
CMD ["uv", "run", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Data Analysis Agent Environment
|
| 2 |
|
| 3 |
An OpenEnv-compliant RL environment for training and evaluating data analysis agents. Agents execute pandas code against a business dataset to answer analytical questions, graded by deterministic programmatic graders.
|
|
@@ -87,10 +96,28 @@ uv run uvicorn server.app:app --host 0.0.0.0 --port 8000
|
|
| 87 |
OPENAI_API_KEY=sk-... uv run python baseline.py
|
| 88 |
```
|
| 89 |
|
| 90 |
-
### Docker
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
```bash
|
| 92 |
-
|
| 93 |
-
docker run -p 8000:8000 data-analysis-env
|
| 94 |
```
|
| 95 |
|
| 96 |
### Client usage (Python)
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Data Analysis Agent Environment
|
| 3 |
+
emoji: 📊
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
# Data Analysis Agent Environment
|
| 11 |
|
| 12 |
An OpenEnv-compliant RL environment for training and evaluating data analysis agents. Agents execute pandas code against a business dataset to answer analytical questions, graded by deterministic programmatic graders.
|
|
|
|
| 96 |
OPENAI_API_KEY=sk-... uv run python baseline.py
|
| 97 |
```
|
| 98 |
|
| 99 |
+
### Docker (local)
|
| 100 |
+
```bash
|
| 101 |
+
docker build -t data-analysis-env .
|
| 102 |
+
docker run -p 7860:7860 data-analysis-env
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
### Deploy to Hugging Face Spaces
|
| 106 |
+
|
| 107 |
+
This repo is pre-configured for Hugging Face Spaces (Docker SDK). The YAML frontmatter at the top of this file is read by HF to configure the Space.
|
| 108 |
+
|
| 109 |
+
1. Create a new Space on [huggingface.co/new-space](https://huggingface.co/new-space), select **Docker** as the SDK.
|
| 110 |
+
2. Push this repo to the Space:
|
| 111 |
+
```bash
|
| 112 |
+
git remote add space https://huggingface.co/spaces/<your-username>/<space-name>
|
| 113 |
+
git push space main
|
| 114 |
+
```
|
| 115 |
+
3. HF will build the `Dockerfile` at the repo root and expose the server on port `7860`.
|
| 116 |
+
4. Your environment URL will be `https://<your-username>-<space-name>.hf.space`.
|
| 117 |
+
|
| 118 |
+
Point `baseline.py` at the deployed Space:
|
| 119 |
```bash
|
| 120 |
+
OPENAI_API_KEY=sk-... uv run python baseline.py --base-url https://<your-username>-<space-name>.hf.space
|
|
|
|
| 121 |
```
|
| 122 |
|
| 123 |
### Client usage (Python)
|