Spaces:
Running
Running
Ron Au
commited on
Commit
•
47ab990
1
Parent(s):
24eb369
fix(FastAPI): Allow HEAD request on root
Browse files
app.py
CHANGED
@@ -2,15 +2,15 @@ from time import time
|
|
2 |
from statistics import mean
|
3 |
|
4 |
from fastapi import BackgroundTasks, FastAPI
|
5 |
-
|
6 |
-
|
7 |
|
8 |
from modules.details import rand_details
|
9 |
from modules.inference import generate_image
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
13 |
-
|
14 |
|
15 |
tasks = {}
|
16 |
|
@@ -70,8 +70,7 @@ def process_task(task_id):
|
|
70 |
@app.head('/')
|
71 |
@app.get('/')
|
72 |
def index():
|
73 |
-
return
|
74 |
-
# return FileResponse(path="static/index.html", media_type="text/html")
|
75 |
|
76 |
|
77 |
@app.get('/details')
|
|
|
2 |
from statistics import mean
|
3 |
|
4 |
from fastapi import BackgroundTasks, FastAPI
|
5 |
+
from fastapi.staticfiles import StaticFiles
|
6 |
+
from fastapi.responses import FileResponse
|
7 |
|
8 |
from modules.details import rand_details
|
9 |
from modules.inference import generate_image
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
13 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
14 |
|
15 |
tasks = {}
|
16 |
|
|
|
70 |
@app.head('/')
|
71 |
@app.get('/')
|
72 |
def index():
|
73 |
+
return FileResponse(path="static/index.html", media_type="text/html")
|
|
|
74 |
|
75 |
|
76 |
@app.get('/details')
|