Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -1245,6 +1245,14 @@ def generate_usage_html(usage_data: Dict[str, Any], days: int = 7): # Added 'day
|
|
1245 |
</html>
|
1246 |
"""
|
1247 |
return html_content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1248 |
|
1249 |
@app.on_event("startup")
|
1250 |
async def startup_event():
|
|
|
1245 |
</html>
|
1246 |
"""
|
1247 |
return html_content
|
1248 |
+
@app.get("/usage/page", response_class=HTMLResponse)
|
1249 |
+
async def usage_page(days: int = 7):
|
1250 |
+
"""
|
1251 |
+
Serves the usage statistics as an HTML page.
|
1252 |
+
"""
|
1253 |
+
usage_data = await get_usage_json(days)
|
1254 |
+
html = generate_usage_html(usage_data, days)
|
1255 |
+
return HTMLResponse(content=html)
|
1256 |
|
1257 |
@app.on_event("startup")
|
1258 |
async def startup_event():
|