monikahung commited on
Commit
5c001b6
·
1 Parent(s): 027a5b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -12,6 +12,7 @@ from fastapi.responses import JSONResponse
12
  import uvicorn
13
  import shutil
14
  import pandas as pd
 
15
 
16
  app = FastAPI()
17
 
@@ -201,7 +202,8 @@ def validate_video_with_git(video_path, mission_type):
201
  # Endpoint untuk validasi video
202
  @app.post("/validate")
203
  async def validate_video(file: UploadFile = File(...), mission_type: str = Form(...)):
204
- temp_file_path = os.path.join(TEMP_DIR, file.filename)
 
205
  try:
206
  with open(temp_file_path, "wb") as buffer:
207
  shutil.copyfileobj(file.file, buffer)
 
12
  import uvicorn
13
  import shutil
14
  import pandas as pd
15
+ import uuid
16
 
17
  app = FastAPI()
18
 
 
202
  # Endpoint untuk validasi video
203
  @app.post("/validate")
204
  async def validate_video(file: UploadFile = File(...), mission_type: str = Form(...)):
205
+ unique_id = uuid.uuid4().hex
206
+ temp_file_path = os.path.join(TEMP_DIR, f"{unique_id}_{file.filename}")
207
  try:
208
  with open(temp_file_path, "wb") as buffer:
209
  shutil.copyfileobj(file.file, buffer)