monikahung commited on
Commit
f0fc7fc
·
verified ·
1 Parent(s): 5c001b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -13,6 +13,8 @@ import uvicorn
13
  import shutil
14
  import pandas as pd
15
  import uuid
 
 
16
 
17
  app = FastAPI()
18
 
@@ -219,6 +221,12 @@ async def validate_video(file: UploadFile = File(...), mission_type: str = Form(
219
  async def root():
220
  return {"status": "Video validation API is running."}
221
 
 
 
 
 
 
 
222
 
223
  if __name__ == "__main__":
224
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
13
  import shutil
14
  import pandas as pd
15
  import uuid
16
+ import atexit
17
+ import shutil
18
 
19
  app = FastAPI()
20
 
 
221
  async def root():
222
  return {"status": "Video validation API is running."}
223
 
224
+ def cleanup():
225
+ print("Membersihkan cache dan file sementara...")
226
+ shutil.rmtree("/tmp", ignore_errors=True)
227
+ shutil.rmtree("/root/.cache", ignore_errors=True)
228
+
229
+ atexit.register(cleanup)
230
 
231
  if __name__ == "__main__":
232
  uvicorn.run(app, host="0.0.0.0", port=7860)