Spaces:
Sleeping
Sleeping
fahmiaziz98
commited on
Commit
·
aa385b3
1
Parent(s):
40ea044
frist commit
Browse files- router/image_clf.py +6 -4
router/image_clf.py
CHANGED
@@ -32,16 +32,18 @@ def image_classification(input: ImageInput)-> ImageOutput:
|
|
32 |
end = time.time()
|
33 |
|
34 |
prediction_time = int((end-start)*1000)
|
35 |
-
|
|
|
|
|
36 |
|
37 |
return ImageOutput(
|
38 |
user_id=input.user_id,
|
39 |
url=input.url,
|
40 |
model_name="vit-human-pose-classification",
|
41 |
-
labels
|
42 |
-
scores
|
43 |
prediction_time=prediction_time
|
44 |
)
|
45 |
|
46 |
except Exception as e:
|
47 |
-
|
|
|
32 |
end = time.time()
|
33 |
|
34 |
prediction_time = int((end-start)*1000)
|
35 |
+
|
36 |
+
labels = [x["label"] for x in output]
|
37 |
+
scores = [x["score"] for x in output]
|
38 |
|
39 |
return ImageOutput(
|
40 |
user_id=input.user_id,
|
41 |
url=input.url,
|
42 |
model_name="vit-human-pose-classification",
|
43 |
+
label=labels,
|
44 |
+
score=scores,
|
45 |
prediction_time=prediction_time
|
46 |
)
|
47 |
|
48 |
except Exception as e:
|
49 |
+
raise HTTPException(status_code=500, detail=f"Failed to process image classification: {e}")
|