davron04 commited on
Commit
6180dbd
·
verified ·
1 Parent(s): 23049ed

Update upload_view.py

Browse files
Files changed (1) hide show
  1. upload_view.py +16 -0
upload_view.py CHANGED
@@ -58,3 +58,19 @@ class Upload_View:
58
 
59
  # Display tumor count and confidence information using Streamlit text element
60
  st.subheader(f"Number of Tumors Detected: {num_tumors}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  # Display tumor count and confidence information using Streamlit text element
60
  st.subheader(f"Number of Tumors Detected: {num_tumors}")
61
+
62
+ # Convert annotated image to bytes for download
63
+ annotated_pil = Image.fromarray(annotated_image)
64
+ img_bytes = annotated_pil.convert("RGB")
65
+ from io import BytesIO
66
+ buf = BytesIO()
67
+ img_bytes.save(buf, format="PNG")
68
+ byte_im = buf.getvalue()
69
+
70
+ # Add download button
71
+ st.download_button(
72
+ label="📥 Download Annotated Image",
73
+ data=byte_im,
74
+ file_name="tumor_prediction.png",
75
+ mime="image/png"
76
+ )