Spaces:
Sleeping
Sleeping
mateoluksenberg
commited on
Commit
•
550c744
1
Parent(s):
8c1ea15
Update app.py
Browse files
app.py
CHANGED
@@ -18,18 +18,17 @@ async def classify_image(file: UploadFile = File(...)):
|
|
18 |
# Perform image classification
|
19 |
result = pipe(image)
|
20 |
|
21 |
-
#
|
22 |
-
|
|
|
23 |
result_with_comment = {
|
24 |
"label": result[0]['label'],
|
25 |
"score": result[0]['score'],
|
26 |
-
"comment":
|
27 |
}
|
28 |
|
29 |
-
# Overall result summary
|
30 |
-
overall_result = "All results: " + str(result)
|
31 |
|
32 |
-
return {"classification_result": result_with_comment
|
33 |
|
34 |
except Exception as e:
|
35 |
# Handle exceptions, for example: file not found, image format issues, etc.
|
|
|
18 |
# Perform image classification
|
19 |
result = pipe(image)
|
20 |
|
21 |
+
# Overall result summary
|
22 |
+
overall_result = "All results: " + str(result)
|
23 |
+
|
24 |
result_with_comment = {
|
25 |
"label": result[0]['label'],
|
26 |
"score": result[0]['score'],
|
27 |
+
"comment": overall_result
|
28 |
}
|
29 |
|
|
|
|
|
30 |
|
31 |
+
return {"classification_result": result_with_comment} # Return the top prediction with comment and overall summary
|
32 |
|
33 |
except Exception as e:
|
34 |
# Handle exceptions, for example: file not found, image format issues, etc.
|