Spaces:
Runtime error
Runtime error
Commit
•
a5c51fb
1
Parent(s):
1fd5f60
Update threshold values in image and video routers
Browse files- app/routers/image.py +1 -1
- app/routers/video.py +5 -3
app/routers/image.py
CHANGED
@@ -11,7 +11,7 @@ router = APIRouter(prefix="/image", tags=["Image"])
|
|
11 |
@router.post("")
|
12 |
async def handleImageRequest(
|
13 |
file: bytes = File(...),
|
14 |
-
threshold: float = 0.
|
15 |
):
|
16 |
try:
|
17 |
img = imfrombytes(file, cv2.IMREAD_COLOR)
|
|
|
11 |
@router.post("")
|
12 |
async def handleImageRequest(
|
13 |
file: bytes = File(...),
|
14 |
+
threshold: float = 0.5,
|
15 |
):
|
16 |
try:
|
17 |
img = imfrombytes(file, cv2.IMREAD_COLOR)
|
app/routers/video.py
CHANGED
@@ -32,8 +32,8 @@ router = APIRouter(prefix="/video", tags=["Video"])
|
|
32 |
async def handleVideoRequest(
|
33 |
file: UploadFile,
|
34 |
background_tasks: BackgroundTasks,
|
35 |
-
threshold: float = 0.
|
36 |
-
user=Depends(get_current_user)
|
37 |
):
|
38 |
if re.search("^video\/", file.content_type) is None:
|
39 |
raise HTTPException(
|
@@ -46,7 +46,9 @@ async def handleVideoRequest(
|
|
46 |
_, artifact_ref = db.collection("artifacts").add(
|
47 |
{"name": id + ".mp4", "status": "pending"}
|
48 |
)
|
49 |
-
db.collection("user").document(user["sub"]).update(
|
|
|
|
|
50 |
os.mkdir(id)
|
51 |
async with aiofiles.open(os.path.join(id, "input.mp4"), "wb") as out_file:
|
52 |
while content := await file.read(102400):
|
|
|
32 |
async def handleVideoRequest(
|
33 |
file: UploadFile,
|
34 |
background_tasks: BackgroundTasks,
|
35 |
+
threshold: float = 0.5,
|
36 |
+
user=Depends(get_current_user),
|
37 |
):
|
38 |
if re.search("^video\/", file.content_type) is None:
|
39 |
raise HTTPException(
|
|
|
46 |
_, artifact_ref = db.collection("artifacts").add(
|
47 |
{"name": id + ".mp4", "status": "pending"}
|
48 |
)
|
49 |
+
db.collection("user").document(user["sub"]).update(
|
50 |
+
{"artifacts": ArrayUnion(["artifact/" + artifact_ref.id])}
|
51 |
+
)
|
52 |
os.mkdir(id)
|
53 |
async with aiofiles.open(os.path.join(id, "input.mp4"), "wb") as out_file:
|
54 |
while content := await file.read(102400):
|