elsoori commited on
Commit
db48f21
1 Parent(s): 6c01855

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -35,9 +35,26 @@ if uploaded_file:
35
 
36
  # Show the rendered result
37
  st.image(rendered_image, caption="Detection Results", use_column_width=True)
 
 
 
38
 
39
  # Display details of detected boxes
40
  st.write("Detection Results:")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  for box in results[0].boxes:
42
  st.write(f"Bounding box: {box.xyxy}")
43
  st.write(f"Confidence: {box.conf}")
 
35
 
36
  # Show the rendered result
37
  st.image(rendered_image, caption="Detection Results", use_column_width=True)
38
+ # Count the number of each cell type
39
+ cell_counts = {"RBC": 0, "WBC": 0, "Platelets": 0}
40
+
41
 
42
  # Display details of detected boxes
43
  st.write("Detection Results:")
44
+ for box in results[0].boxes:
45
+ class_index = int(box.cls) # Get the class index
46
+ if class_index == 1: # RBC
47
+ cell_counts["RBC"] += 1
48
+ elif class_index == 2: # WBC
49
+ cell_counts["WBC"] += 1
50
+ elif class_index == 0: # Platelets
51
+ cell_counts["Platelets"] += 1
52
+
53
+ # Display the counts of each cell type
54
+ st.write("Cell Type Counts:")
55
+ st.write(pd.DataFrame.from_dict(cell_counts, orient='index', columns=['Count']))
56
+
57
+ else:
58
  for box in results[0].boxes:
59
  st.write(f"Bounding box: {box.xyxy}")
60
  st.write(f"Confidence: {box.conf}")