Spaces:
Sleeping
Sleeping
Upload app.py
Browse files- server/app.py +83 -0
server/app.py
CHANGED
|
@@ -13,6 +13,7 @@ sys.path.insert(0, str(Path(__file__).parent))
|
|
| 13 |
|
| 14 |
from fastapi import FastAPI, HTTPException
|
| 15 |
from models import AssistantAction, AssistantObservation, AssistantState
|
|
|
|
| 16 |
from typing import Optional
|
| 17 |
import statistics
|
| 18 |
|
|
@@ -215,6 +216,88 @@ app = FastAPI(
|
|
| 215 |
version="1.0.0"
|
| 216 |
)
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
env = ExecAssistEnv()
|
| 219 |
|
| 220 |
|
|
|
|
| 13 |
|
| 14 |
from fastapi import FastAPI, HTTPException
|
| 15 |
from models import AssistantAction, AssistantObservation, AssistantState
|
| 16 |
+
from fastapi.responses import HTMLResponse
|
| 17 |
from typing import Optional
|
| 18 |
import statistics
|
| 19 |
|
|
|
|
| 216 |
version="1.0.0"
|
| 217 |
)
|
| 218 |
|
| 219 |
+
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
|
| 220 |
+
async def root():
|
| 221 |
+
"""Friendly landing page for the bare URL."""
|
| 222 |
+
return """
|
| 223 |
+
<!DOCTYPE html>
|
| 224 |
+
<html lang="en">
|
| 225 |
+
<head>
|
| 226 |
+
<meta charset="utf-8">
|
| 227 |
+
<title>ExecAssist — OpenEnv Environment</title>
|
| 228 |
+
<style>
|
| 229 |
+
body {
|
| 230 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
| 231 |
+
max-width: 720px;
|
| 232 |
+
margin: 60px auto;
|
| 233 |
+
padding: 0 24px;
|
| 234 |
+
background: #0f0f1a;
|
| 235 |
+
color: #e8e8f0;
|
| 236 |
+
line-height: 1.6;
|
| 237 |
+
}
|
| 238 |
+
h1 { color: #5b9dff; margin-bottom: 4px; }
|
| 239 |
+
.tag { color: #8888aa; font-size: 14px; }
|
| 240 |
+
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; }
|
| 241 |
+
.card {
|
| 242 |
+
background: #1a1a2e;
|
| 243 |
+
border: 1px solid #2a2a44;
|
| 244 |
+
border-radius: 8px;
|
| 245 |
+
padding: 14px 18px;
|
| 246 |
+
text-decoration: none;
|
| 247 |
+
color: #e8e8f0;
|
| 248 |
+
transition: all 0.15s;
|
| 249 |
+
}
|
| 250 |
+
.card:hover { border-color: #5b9dff; background: #1f1f38; }
|
| 251 |
+
.card-title { color: #5b9dff; font-weight: 600; margin-bottom: 4px; }
|
| 252 |
+
.card-desc { color: #aaaabb; font-size: 13px; }
|
| 253 |
+
table { border-collapse: collapse; width: 100%; margin: 16px 0; }
|
| 254 |
+
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #2a2a44; }
|
| 255 |
+
th { color: #5b9dff; font-weight: 600; }
|
| 256 |
+
code { background: #1a1a2e; padding: 2px 6px; border-radius: 4px; color: #a8d4ff; }
|
| 257 |
+
</style>
|
| 258 |
+
</head>
|
| 259 |
+
<body>
|
| 260 |
+
<h1>📧 ExecAssist</h1>
|
| 261 |
+
<div class="tag">An OpenEnv environment for executive assistant email + calendar tasks · Theme #3.2</div>
|
| 262 |
+
|
| 263 |
+
<p>An AI agent reads incoming emails, checks the calendar, drafts professional replies, and books meetings — without double-booking or breaking working hours. Trained with TRL GRPO on Qwen2.5-0.5B.</p>
|
| 264 |
+
|
| 265 |
+
<h3>Quick links</h3>
|
| 266 |
+
<div class="grid">
|
| 267 |
+
<a class="card" href="/docs">
|
| 268 |
+
<div class="card-title">📘 Interactive API docs</div>
|
| 269 |
+
<div class="card-desc">Swagger UI — try /reset and /step</div>
|
| 270 |
+
</a>
|
| 271 |
+
<a class="card" href="/health">
|
| 272 |
+
<div class="card-title">💚 Health check</div>
|
| 273 |
+
<div class="card-desc">Service liveness probe</div>
|
| 274 |
+
</a>
|
| 275 |
+
<a class="card" href="/tasks">
|
| 276 |
+
<div class="card-title">📋 List tasks</div>
|
| 277 |
+
<div class="card-desc">All 3 difficulty levels</div>
|
| 278 |
+
</a>
|
| 279 |
+
<a class="card" href="/metadata">
|
| 280 |
+
<div class="card-title">🧾 Metadata</div>
|
| 281 |
+
<div class="card-desc">Environment info + version</div>
|
| 282 |
+
</a>
|
| 283 |
+
</div>
|
| 284 |
+
|
| 285 |
+
<h3>Training results</h3>
|
| 286 |
+
<table>
|
| 287 |
+
<tr><th>Task</th><th>Baseline</th><th>Trained (GRPO)</th><th>Δ</th></tr>
|
| 288 |
+
<tr><td>Easy</td><td>0.345</td><td><b>0.995</b></td><td>+188%</td></tr>
|
| 289 |
+
<tr><td>Medium</td><td>0.227</td><td><b>0.745</b></td><td>+228%</td></tr>
|
| 290 |
+
<tr><td>Hard</td><td>0.249</td><td><b>0.737</b></td><td>+196%</td></tr>
|
| 291 |
+
</table>
|
| 292 |
+
|
| 293 |
+
<p style="color:#8888aa; font-size:13px; margin-top:32px;">
|
| 294 |
+
Built for the OpenEnv Hackathon · April 2026 · by
|
| 295 |
+
<a href="https://huggingface.co/DevanshuDon" style="color:#5b9dff;">@DevanshuDon</a>
|
| 296 |
+
</p>
|
| 297 |
+
</body>
|
| 298 |
+
</html>
|
| 299 |
+
"""
|
| 300 |
+
|
| 301 |
env = ExecAssistEnv()
|
| 302 |
|
| 303 |
|