Spaces:
Sleeping
Sleeping
add category, location,isapproved in to video table
Browse files
app.py
CHANGED
|
@@ -62,10 +62,12 @@ def get_gps_location(file_stream):
|
|
| 62 |
return lat, lon
|
| 63 |
return None, None
|
| 64 |
|
| 65 |
-
def process_video_in_background(video_data: bytes, video_guid: str, filename: str):
|
| 66 |
bucket_name = 'pothole-images'
|
| 67 |
try:
|
| 68 |
-
supabase.table("videos").insert({"guid": video_guid, "video_name": filename, "status": "processing"
|
|
|
|
|
|
|
| 69 |
except Exception as e:
|
| 70 |
print(f"DB Error on video insert: {str(e)}")
|
| 71 |
return
|
|
@@ -299,7 +301,7 @@ async def upload_video(background_tasks: BackgroundTasks, location: str = Form(N
|
|
| 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}
|
| 304 |
|
| 305 |
@app.get("/video_report/{guid}")
|
|
|
|
| 62 |
return lat, lon
|
| 63 |
return None, None
|
| 64 |
|
| 65 |
+
def process_video_in_background(video_data: bytes, video_guid: str, filename: str, location_point: str , location: str , is_approved: int , getvariancevalue: str, category: str):
|
| 66 |
bucket_name = 'pothole-images'
|
| 67 |
try:
|
| 68 |
+
supabase.table("videos").insert({"guid": video_guid, "video_name": filename, "status": "processing",
|
| 69 |
+
"location": location_point, "location_text": f"{lon:.6f} {lat:.6f}" if lat and lon else location or None,
|
| 70 |
+
"category": category, "approved": is_approved, "variance": getvariancevalue}).execute()
|
| 71 |
except Exception as e:
|
| 72 |
print(f"DB Error on video insert: {str(e)}")
|
| 73 |
return
|
|
|
|
| 301 |
print(f"variancevalue: {getvariancevalue}")
|
| 302 |
print(f"category: {category}")
|
| 303 |
print(f"Step2")
|
| 304 |
+
background_tasks.add_task(process_video_in_background, video_data, video_guid, file.filename, location_point, location, is_approved, getvariancevalue, category)
|
| 305 |
return {"message": "Video upload successful. Processing has started.", "video_guid": video_guid}
|
| 306 |
|
| 307 |
@app.get("/video_report/{guid}")
|