fahmiaziz98 commited on
Commit
aa385b3
·
1 Parent(s): 40ea044

frist commit

Browse files
Files changed (1) hide show
  1. 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
- labels_and_scores = [{"label": x['label'], "score": x['score']} for x in output]
 
 
36
 
37
  return ImageOutput(
38
  user_id=input.user_id,
39
  url=input.url,
40
  model_name="vit-human-pose-classification",
41
- labels=[x['label'] for x in labels_and_scores],
42
- scores=[x['score'] for x in labels_and_scores],
43
  prediction_time=prediction_time
44
  )
45
 
46
  except Exception as e:
47
- return {"error": f"Failed to process image classification: {str(e)}"}, 500
 
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}")