Spaces:
Sleeping
Sleeping
request type specified
Browse files
main.py
CHANGED
|
@@ -1,15 +1,17 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from fastapi.responses import HTMLResponse
|
| 3 |
from fastapi.staticfiles import StaticFiles
|
| 4 |
from fastapi.templating import Jinja2Templates
|
| 5 |
-
|
| 6 |
from typing import List, Literal, Optional
|
| 7 |
from pydantic import BaseModel
|
| 8 |
import pandas as pd
|
| 9 |
-
|
| 10 |
-
import os
|
| 11 |
-
import json
|
| 12 |
-
import logging
|
| 13 |
|
| 14 |
# logger
|
| 15 |
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
|
|
@@ -131,8 +133,8 @@ labels = ml_objects["labels"]
|
|
| 131 |
|
| 132 |
# Root endpoint to serve index.html template
|
| 133 |
@app.get("/", response_class=HTMLResponse)
|
| 134 |
-
def root(request):
|
| 135 |
-
return templates.TemplateResponse("index.html", {
|
| 136 |
|
| 137 |
|
| 138 |
@app.get("/checkup")
|
|
|
|
| 1 |
+
import uvicorn
|
| 2 |
+
import pickle
|
| 3 |
+
import os
|
| 4 |
+
import json
|
| 5 |
+
import logging
|
| 6 |
+
from fastapi import FastAPI, Request
|
| 7 |
from fastapi.responses import HTMLResponse
|
| 8 |
from fastapi.staticfiles import StaticFiles
|
| 9 |
from fastapi.templating import Jinja2Templates
|
| 10 |
+
|
| 11 |
from typing import List, Literal, Optional
|
| 12 |
from pydantic import BaseModel
|
| 13 |
import pandas as pd
|
| 14 |
+
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# logger
|
| 17 |
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
|
|
|
|
| 133 |
|
| 134 |
# Root endpoint to serve index.html template
|
| 135 |
@app.get("/", response_class=HTMLResponse)
|
| 136 |
+
async def root(request: Request):
|
| 137 |
+
return templates.TemplateResponse("index.html", {'request': request})
|
| 138 |
|
| 139 |
|
| 140 |
@app.get("/checkup")
|