Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- server/app.py +42 -0
server/app.py
CHANGED
|
@@ -7,6 +7,7 @@
|
|
| 7 |
"""FastAPI application for the LogiFlow-RL OpenEnv environment."""
|
| 8 |
|
| 9 |
from fastapi import FastAPI
|
|
|
|
| 10 |
|
| 11 |
try:
|
| 12 |
from openenv.core.env_server.types import (
|
|
@@ -56,6 +57,47 @@ app = FastAPI(
|
|
| 56 |
env = CrisisLogisticsEnvironment()
|
| 57 |
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
@app.post("/reset", response_model=ResetResponse, tags=["Environment Control"])
|
| 60 |
async def reset_environment(request: ResetRequest) -> ResetResponse:
|
| 61 |
task_id = getattr(request, "task_id", None) or "easy"
|
|
|
|
| 7 |
"""FastAPI application for the LogiFlow-RL OpenEnv environment."""
|
| 8 |
|
| 9 |
from fastapi import FastAPI
|
| 10 |
+
from fastapi.responses import HTMLResponse
|
| 11 |
|
| 12 |
try:
|
| 13 |
from openenv.core.env_server.types import (
|
|
|
|
| 57 |
env = CrisisLogisticsEnvironment()
|
| 58 |
|
| 59 |
|
| 60 |
+
@app.get("/", response_class=HTMLResponse, tags=["Environment Info"])
|
| 61 |
+
async def root() -> HTMLResponse:
|
| 62 |
+
return HTMLResponse(
|
| 63 |
+
"""
|
| 64 |
+
<html>
|
| 65 |
+
<head><title>LogiFlow-RL</title></head>
|
| 66 |
+
<body style="font-family: Arial, sans-serif; margin: 40px;">
|
| 67 |
+
<h1>LogiFlow-RL</h1>
|
| 68 |
+
<p>OpenEnv benchmark for dynamic logistics routing.</p>
|
| 69 |
+
<ul>
|
| 70 |
+
<li><a href="/docs">API docs</a></li>
|
| 71 |
+
<li><a href="/health">Health</a></li>
|
| 72 |
+
<li><a href="/schema">Schema</a></li>
|
| 73 |
+
<li><a href="/web">Web landing page</a></li>
|
| 74 |
+
</ul>
|
| 75 |
+
</body>
|
| 76 |
+
</html>
|
| 77 |
+
"""
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
@app.get("/web", response_class=HTMLResponse, tags=["Environment Info"])
|
| 82 |
+
async def web_landing() -> HTMLResponse:
|
| 83 |
+
return HTMLResponse(
|
| 84 |
+
"""
|
| 85 |
+
<html>
|
| 86 |
+
<head><title>LogiFlow-RL Web</title></head>
|
| 87 |
+
<body style="font-family: Arial, sans-serif; margin: 40px;">
|
| 88 |
+
<h1>LogiFlow-RL</h1>
|
| 89 |
+
<p>The environment is live. Use the links below to explore it.</p>
|
| 90 |
+
<ul>
|
| 91 |
+
<li><a href="/docs">Swagger docs</a></li>
|
| 92 |
+
<li><a href="/health">Health endpoint</a></li>
|
| 93 |
+
<li><a href="/schema">JSON schema</a></li>
|
| 94 |
+
</ul>
|
| 95 |
+
</body>
|
| 96 |
+
</html>
|
| 97 |
+
"""
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
@app.post("/reset", response_model=ResetResponse, tags=["Environment Control"])
|
| 102 |
async def reset_environment(request: ResetRequest) -> ResetResponse:
|
| 103 |
task_id = getattr(request, "task_id", None) or "easy"
|