mateoluksenberg commited on
Commit
550c744
1 Parent(s): 8c1ea15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -18,18 +18,17 @@ async def classify_image(file: UploadFile = File(...)):
18
  # Perform image classification
19
  result = pipe(image)
20
 
21
- # Add an additional comment to the top result
22
- additional_comment = " - This is the classification result."
 
23
  result_with_comment = {
24
  "label": result[0]['label'],
25
  "score": result[0]['score'],
26
- "comment": additional_comment
27
  }
28
 
29
- # Overall result summary
30
- overall_result = "All results: " + str(result)
31
 
32
- return {"classification_result": result_with_comment, "overall_result": overall_result} # Return the top prediction with comment and overall summary
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.