Songyou commited on
Commit
7a02397
·
verified ·
1 Parent(s): 9c90c2f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -11,11 +11,11 @@ logger = logging.getLogger(__name__)
11
  class UserInput(BaseModel):
12
  user_input: str
13
 
14
- @app.get("/", response_class=HTMLResponse)
15
- async def read_root():
16
- # 提供前端 HTML 文件
17
- with open("index.html", "r") as file:
18
- return file.read()
19
 
20
  @app.post("/submit")
21
  async def submit_input(input_data: UserInput):
 
11
  class UserInput(BaseModel):
12
  user_input: str
13
 
14
+ app.mount("/", StaticFiles(directory="static", html=True), name="static")
15
+
16
+ @app.get("/")
17
+ def index() -> FileResponse:
18
+ return FileResponse(path="/app/static/index.html", media_type="text/html")
19
 
20
  @app.post("/submit")
21
  async def submit_input(input_data: UserInput):