limcheekin commited on
Commit
a89e25b
·
1 Parent(s): 7652cb7

feat: improved python code for the index.html loading

Browse files
Files changed (1) hide show
  1. main.py +4 -2
main.py CHANGED
@@ -11,11 +11,13 @@ app = create_app(
11
  )
12
  )
13
 
 
 
 
 
14
 
15
  @app.get("/", response_class=HTMLResponse)
16
  async def read_items():
17
- with open("index.html", "r") as f:
18
- content = f.read()
19
  return content
20
 
21
  if __name__ == "__main__":
 
11
  )
12
  )
13
 
14
+ # Read the content of index.html once and store it in memory
15
+ with open("index.html", "r") as f:
16
+ content = f.read()
17
+
18
 
19
  @app.get("/", response_class=HTMLResponse)
20
  async def read_items():
 
 
21
  return content
22
 
23
  if __name__ == "__main__":