dharak003 commited on
Commit
35610d2
Β·
verified Β·
1 Parent(s): 853c4ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -1
app.py CHANGED
@@ -63,13 +63,47 @@ st.markdown("""
63
  """, unsafe_allow_html=True)
64
 
65
  # Header Section
66
- st.title("πŸ“„ Medical Report Summarizer")
67
  st.markdown("""
68
  <div style="background-color: #4CAF50; padding: 10px; border-radius: 10px;">
69
  <h2 style="color: white; text-align: center;">Upload your medical report and get a summarized analysis!</h2>
70
  </div>
71
  """, unsafe_allow_html=True)
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  # File Upload Section
74
  st.write("### Upload your medical report (image, PDF, or Word document):")
75
  uploaded_file = st.file_uploader("", type=["pdf", "doc", "docx", "jpg", "jpeg", "png", "webp"])
 
63
  """, unsafe_allow_html=True)
64
 
65
  # Header Section
66
+ st.title("πŸ“„ Call on Doc Medical Report Summarizer")
67
  st.markdown("""
68
  <div style="background-color: #4CAF50; padding: 10px; border-radius: 10px;">
69
  <h2 style="color: white; text-align: center;">Upload your medical report and get a summarized analysis!</h2>
70
  </div>
71
  """, unsafe_allow_html=True)
72
 
73
+ # Add demo images to the app
74
+ st.write("### Test with Demo Images:")
75
+ demo_images = {
76
+ "Test Report 1": "report1.webp",
77
+ "Test Report 2": "report2.webp",
78
+ "Test Report 3": "report3.webp"
79
+ }
80
+
81
+ # Dropdown to select a demo image
82
+ selected_demo = st.selectbox("Choose a demo image to test:", options=["None"] + list(demo_images.keys()))
83
+
84
+ if selected_demo != "None":
85
+ demo_image_path = demo_images[selected_demo]
86
+ with open(demo_image_path, "rb") as file:
87
+ demo_file = file.read()
88
+ # st.image(demo_image_path, caption=f"Selected Demo: {selected_demo}", use_column_width=True)
89
+
90
+ # Process the selected demo image
91
+ with st.spinner("πŸ”„ Processing the demo image..."):
92
+ summary = summarize_report(file=open(demo_image_path, "rb"), file_type="image/jpeg")
93
+
94
+ # Display Summary
95
+ st.success("βœ… Demo image processed successfully!")
96
+ st.subheader("Summarized Report:")
97
+ st.write(summary)
98
+
99
+ # Download Button for Summary
100
+ st.download_button(
101
+ label="πŸ“₯ Download Summary",
102
+ data=summary,
103
+ file_name=f"{selected_demo}_summary.txt",
104
+ mime="text/plain"
105
+ )
106
+
107
  # File Upload Section
108
  st.write("### Upload your medical report (image, PDF, or Word document):")
109
  uploaded_file = st.file_uploader("", type=["pdf", "doc", "docx", "jpg", "jpeg", "png", "webp"])