Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,11 +11,23 @@ st.set_page_config(
|
|
11 |
)
|
12 |
|
13 |
# Sidebar
|
14 |
-
st.sidebar.image("https://cdn-icons-png.flaticon.com/512/2965/2965567.png", width=100)
|
15 |
st.sidebar.title("π MediAssist")
|
16 |
st.sidebar.markdown("Analyze prescriptions with ease using AI")
|
17 |
st.sidebar.markdown("---")
|
18 |
-
st.sidebar.markdown("π€ Developed by Yash Jadhav")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Main Title
|
21 |
st.markdown("""
|
@@ -36,17 +48,19 @@ if uploaded_file:
|
|
36 |
temp_file.write(uploaded_file.read())
|
37 |
temp_path = temp_file.name
|
38 |
|
39 |
-
# Read
|
40 |
image = cv2.imread(temp_path)
|
41 |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
42 |
|
43 |
-
#
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
|
48 |
with col1:
|
49 |
-
st.image(
|
50 |
|
51 |
with col2:
|
52 |
st.success("β
Prescription Uploaded & Preprocessed Successfully")
|
|
|
11 |
)
|
12 |
|
13 |
# Sidebar
|
|
|
14 |
st.sidebar.title("π MediAssist")
|
15 |
st.sidebar.markdown("Analyze prescriptions with ease using AI")
|
16 |
st.sidebar.markdown("---")
|
17 |
+
st.sidebar.markdown("π€ Developed by **Yash Jadhav**")
|
18 |
+
|
19 |
+
# Social Buttons
|
20 |
+
st.sidebar.markdown("π **Connect with me:**")
|
21 |
+
st.sidebar.markdown("""
|
22 |
+
<a href="https://github.com/Yashjadhav1503" target="_blank">
|
23 |
+
<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white" style="height:35px;">
|
24 |
+
</a><br>
|
25 |
+
<a href="https://www.linkedin.com/in/yash-jadhav-1503/" target="_blank">
|
26 |
+
<img src="https://img.shields.io/badge/LinkedIn-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" style="height:35px;">
|
27 |
+
</a>
|
28 |
+
""", unsafe_allow_html=True)
|
29 |
+
|
30 |
+
st.sidebar.markdown("---")
|
31 |
|
32 |
# Main Title
|
33 |
st.markdown("""
|
|
|
48 |
temp_file.write(uploaded_file.read())
|
49 |
temp_path = temp_file.name
|
50 |
|
51 |
+
# Step 1: Read and convert to grayscale
|
52 |
image = cv2.imread(temp_path)
|
53 |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
54 |
|
55 |
+
# Step 2: Inverse Binary Thresholding
|
56 |
+
_, binary_inv = cv2.threshold(gray, 128, 255, cv2.THRESH_BINARY_INV)
|
57 |
+
|
58 |
+
# Step 3: Dilation with 2 iterations
|
59 |
+
kernel = np.ones((3, 3), np.uint8)
|
60 |
+
dilated = cv2.dilate(binary_inv, kernel, iterations=1)
|
61 |
|
62 |
with col1:
|
63 |
+
st.image(dilated, caption="Preprocessed Prescription", channels="GRAY", use_column_width=True)
|
64 |
|
65 |
with col2:
|
66 |
st.success("β
Prescription Uploaded & Preprocessed Successfully")
|