Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
|
Download src/envs/coding_env/server/README.md from sergiopaniego/coding-env: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/sergiopaniego/coding-env/resolve/main/src/envs/coding_env/server/README.md
- Command line
-
hf download hf://spaces/sergiopaniego/coding-env/src/envs/coding_env/server/README.md
-
curl -L -o README.md https://huggingface.co/spaces/sergiopaniego/coding-env/resolve/main/src/envs/coding_env/server/README.md
1.02 kB
CodingEnv HTTP Server
This directory contains the HTTP server implementation for the CodingEnvironment.
Running Locally
Prerequisites
pip install fastapi uvicorn
Start the server
# From the project root (/Users/pankit/git/envtorch)
cd src
uvicorn envs.coding_env.server.app:app --reload --host 0.0.0.0 --port 8000
The server will be available at http://localhost:8000
API Endpoints
POST /reset- Reset the environmentPOST /step- Execute a code actionGET /state- Get current environment stateGET /health- Health check
Test with curl
# Health check
curl http://localhost:8000/health
# Reset
curl -X POST http://localhost:8000/reset \
-H "Content-Type: application/json" \
-d '{}'
# Execute code
curl -X POST http://localhost:8000/step \
-H "Content-Type: application/json" \
-d '{
"action": {
"code": "print(\"Hello from HTTP!\")"
},
"timeout_s": 15
}'
# Get state
curl http://localhost:8000/state