Fred808 commited on
Commit
805923a
·
verified ·
1 Parent(s): 775c52f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -0
main.py CHANGED
@@ -56,6 +56,13 @@ logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(me
56
  # === Prepare output folder ===
57
  os.makedirs(OUTPUT_DIR, exist_ok=True)
58
 
 
 
 
 
 
 
 
59
  # === Upload Function ===
60
  def upload_to_dataset(filepath):
61
  try:
@@ -119,3 +126,5 @@ async def lifespan(app: FastAPI):
119
 
120
  # === FastAPI App ===
121
  app = FastAPI(lifespan=lifespan)
 
 
 
56
  # === Prepare output folder ===
57
  os.makedirs(OUTPUT_DIR, exist_ok=True)
58
 
59
+ app = FastAPI()
60
+
61
+ # === DUMMY ROUTE TO KEEP SERVER HEALTHY ===
62
+ @app.get("/")
63
+ def keep_alive():
64
+ return {"status": "running"}
65
+
66
  # === Upload Function ===
67
  def upload_to_dataset(filepath):
68
  try:
 
126
 
127
  # === FastAPI App ===
128
  app = FastAPI(lifespan=lifespan)
129
+ # Re-assign app with lifespan logic
130
+ app.router.lifespan_context = lifespan