Empereur-Pirate commited on
Commit
64a93dc
·
verified ·
1 Parent(s): b20b823

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -5
main.py CHANGED
@@ -5,6 +5,9 @@ from fastapi.staticfiles import StaticFiles
5
 
6
  app = FastAPI()
7
 
 
 
 
8
  pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
9
 
10
  def t5(input):
@@ -22,9 +25,7 @@ def infer_endpoint(data: dict):
22
  return result
23
 
24
  # Route to render and present the index.html file
25
- @app.get("/", response_class=HTMLResponse)
26
- async def index(request: Request):
27
- return FileResponse("/static/index.html")
28
 
29
- # Serve the static files
30
- app.mount("/static", StaticFiles(directory="static"), name="static")
 
5
 
6
  app = FastAPI()
7
 
8
+ # Serve the static files
9
+ app.mount("/static", StaticFiles(directory="static"), name="static")
10
+
11
  pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
12
 
13
  def t5(input):
 
25
  return result
26
 
27
  # Route to render and present the index.html file
28
+ @app.get("/", response_class=Response)
29
+ async def index():
30
+ return Response(open("/static/index.html").read(), media_type="text/html")
31