Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -12,7 +12,9 @@ def detect_product_in_frame(frame):
|
|
| 12 |
|
| 13 |
@app.post("/process_video/")
|
| 14 |
async def process_video(file: UploadFile = File(...)):
|
| 15 |
-
input_filename = f"input_{uuid.uuid4()}.mp4"
|
|
|
|
|
|
|
| 16 |
with open(input_filename, "wb") as f:
|
| 17 |
f.write(await file.read())
|
| 18 |
|
|
@@ -24,8 +26,6 @@ async def process_video(file: UploadFile = File(...)):
|
|
| 24 |
roi_box = detect_product_in_frame(frame)
|
| 25 |
cap.release()
|
| 26 |
|
| 27 |
-
output_filename = f"output_{uuid.uuid4()}.mp4"
|
| 28 |
-
|
| 29 |
if roi_box:
|
| 30 |
x, y, w, h = roi_box
|
| 31 |
crop_cmd = [
|
|
|
|
| 12 |
|
| 13 |
@app.post("/process_video/")
|
| 14 |
async def process_video(file: UploadFile = File(...)):
|
| 15 |
+
input_filename = f"/tmp/input_{uuid.uuid4()}.mp4"
|
| 16 |
+
output_filename = f"/tmp/output_{uuid.uuid4()}.mp4"
|
| 17 |
+
|
| 18 |
with open(input_filename, "wb") as f:
|
| 19 |
f.write(await file.read())
|
| 20 |
|
|
|
|
| 26 |
roi_box = detect_product_in_frame(frame)
|
| 27 |
cap.release()
|
| 28 |
|
|
|
|
|
|
|
| 29 |
if roi_box:
|
| 30 |
x, y, w, h = roi_box
|
| 31 |
crop_cmd = [
|