sunilchm commited on
Commit
bd8261f
·
1 Parent(s): 262166a

add category in to vedeps table

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -280,16 +280,24 @@ async def update_frame_status(frame_id: int, payload: dict = Body(...)):
280
 
281
 
282
  @app.post("/upload_video")
283
- async def upload_video(background_tasks: BackgroundTasks, location: str = Form(None), file: UploadFile = File(...)):
284
  if not file.content_type.startswith('video/'):
285
  raise HTTPException(status_code=400, detail="File is not a video.")
286
  video_data = await file.read()
287
  video_guid = str(uuid.uuid4())
288
  lat, lon = get_gps_location(file.file)
289
  location_point = f"Point({lon:.6f} {lat:.6f})" if lat and lon else None
 
 
 
 
 
290
  print(f"Step1")
291
- print(f"location: {location}")
292
- print(f"location_point: {location_point}")
 
 
 
293
  print(f"Step2")
294
  background_tasks.add_task(process_video_in_background, video_data, video_guid, file.filename)
295
  return {"message": "Video upload successful. Processing has started.", "video_guid": video_guid}
 
280
 
281
 
282
  @app.post("/upload_video")
283
+ async def upload_video(background_tasks: BackgroundTasks, location: str = Form(None), category: str = Form(...), file: UploadFile = File(...)):
284
  if not file.content_type.startswith('video/'):
285
  raise HTTPException(status_code=400, detail="File is not a video.")
286
  video_data = await file.read()
287
  video_guid = str(uuid.uuid4())
288
  lat, lon = get_gps_location(file.file)
289
  location_point = f"Point({lon:.6f} {lat:.6f})" if lat and lon else None
290
+ validation_response = supabase.table("validation").select("location_text").execute()
291
+ approved_locations = {item['location_text'] for item in validation_response.data}
292
+ is_approved = 1 if location in approved_locations else 0
293
+ variance_levels = ["Low", "Mid", "High"]
294
+ getvariancevalue = random.choice(variance_levels) if category == "potholes" else None
295
  print(f"Step1")
296
+ print(f"location_point: {location_point}")
297
+ print(f"location : {location}")
298
+ print(f"is approved : {is_approved}")
299
+ print(f"variancevalue: {getvariancevalue}")
300
+ print(f"category: {category}")
301
  print(f"Step2")
302
  background_tasks.add_task(process_video_in_background, video_data, video_guid, file.filename)
303
  return {"message": "Video upload successful. Processing has started.", "video_guid": video_guid}