Fred808 commited on
Commit
20d1126
·
verified ·
1 Parent(s): f5437f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -13,7 +13,6 @@ ANNOTATIONS_ZIP = "annotations.zip"
13
 
14
  @asynccontextmanager
15
  async def lifespan(app: FastAPI):
16
- # --- This replaces the old @app.on_event("startup") ---
17
  video_dir = "videos"
18
  cursor_dir = "cursors"
19
  os.makedirs(FRAMES_DIR, exist_ok=True)
@@ -35,7 +34,7 @@ async def lifespan(app: FastAPI):
35
  for file in files:
36
  zipf.write(os.path.join(root, file), arcname=file)
37
  print("Pipeline complete and outputs zipped.")
38
- yield # This is required for the lifespan context
39
 
40
  app = FastAPI(lifespan=lifespan)
41
 
@@ -45,4 +44,4 @@ def download_frames():
45
 
46
  @app.get("/download/annotations")
47
  def download_annotations():
48
- return FileResponse(ANNOTATIONS_ZIP, filename=ANNOTATIONS_ZIP)
 
13
 
14
  @asynccontextmanager
15
  async def lifespan(app: FastAPI):
 
16
  video_dir = "videos"
17
  cursor_dir = "cursors"
18
  os.makedirs(FRAMES_DIR, exist_ok=True)
 
34
  for file in files:
35
  zipf.write(os.path.join(root, file), arcname=file)
36
  print("Pipeline complete and outputs zipped.")
37
+ yield
38
 
39
  app = FastAPI(lifespan=lifespan)
40
 
 
44
 
45
  @app.get("/download/annotations")
46
  def download_annotations():
47
+ return FileResponse(ANNOTATIONS_ZIP, filename=ANNOTATIONS_ZIP)