Update app.py
Browse files
app.py
CHANGED
@@ -92,7 +92,7 @@ def main():
|
|
92 |
def change_photo_state():
|
93 |
st.session_state["photo"]="done"
|
94 |
c1, c2, c3 = st.columns([2,2,1])
|
95 |
-
if st.checkbox("Summarize
|
96 |
with st.container():
|
97 |
message = c1.text_input("Type your text here!")
|
98 |
uploaded_photo=None
|
@@ -103,6 +103,7 @@ def main():
|
|
103 |
CaptureImage =False
|
104 |
if c3.button("Upload Images/PDFs"):
|
105 |
uploaded_photo = c3.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
|
|
106 |
time.sleep(3)
|
107 |
if st.session_state["photo"]=="done" or message:
|
108 |
if uploaded_photo and uploaded_photo.type=='application/pdf':
|
@@ -132,12 +133,11 @@ def main():
|
|
132 |
img = img.save("img.png")
|
133 |
img = cv2.imread("img.png")
|
134 |
st.text("Select the summarization type:")
|
135 |
-
|
136 |
-
if c4.button("BENGALI"):
|
137 |
text = pytesseract.image_to_string(img, lang="ben")
|
138 |
st.subheader("সারাংশ/সারমর্ম")
|
139 |
bansum(text)
|
140 |
-
if
|
141 |
text=pytesseract.image_to_string(img)
|
142 |
st.subheader("Summarized Text")
|
143 |
engsum(text)
|
@@ -149,22 +149,20 @@ def main():
|
|
149 |
img = cv2.imread("img.png")
|
150 |
#text = pytesseract.image_to_string(img) if st.checkbox("Bangla") else pytesseract.image_to_string(img, lang="ben")
|
151 |
st.text("Select the summarization type:")
|
152 |
-
|
153 |
-
if c6.button("Bangla"):
|
154 |
text = pytesseract.image_to_string(img, lang="ben")
|
155 |
st.subheader("সারাংশ/সারমর্ম")
|
156 |
bansum(text)
|
157 |
-
if
|
158 |
text=pytesseract.image_to_string(img)
|
159 |
st.subheader("Summarized Text")
|
160 |
engsum(text)
|
161 |
else:
|
162 |
text=None
|
163 |
text = message
|
164 |
-
|
165 |
-
if c8.button("Bangla"):
|
166 |
bansum(text)
|
167 |
-
if
|
168 |
engsum(text)
|
169 |
if st.checkbox("Conversate"):
|
170 |
with st.container():
|
|
|
92 |
def change_photo_state():
|
93 |
st.session_state["photo"]="done"
|
94 |
c1, c2, c3 = st.columns([2,2,1])
|
95 |
+
if st.checkbox("Summarize"):
|
96 |
with st.container():
|
97 |
message = c1.text_input("Type your text here!")
|
98 |
uploaded_photo=None
|
|
|
103 |
CaptureImage =False
|
104 |
if c3.button("Upload Images/PDFs"):
|
105 |
uploaded_photo = c3.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
106 |
+
Summarize=True
|
107 |
time.sleep(3)
|
108 |
if st.session_state["photo"]=="done" or message:
|
109 |
if uploaded_photo and uploaded_photo.type=='application/pdf':
|
|
|
133 |
img = img.save("img.png")
|
134 |
img = cv2.imread("img.png")
|
135 |
st.text("Select the summarization type:")
|
136 |
+
if st.button("BENGALI"):
|
|
|
137 |
text = pytesseract.image_to_string(img, lang="ben")
|
138 |
st.subheader("সারাংশ/সারমর্ম")
|
139 |
bansum(text)
|
140 |
+
if st.button("ENGLISH"):
|
141 |
text=pytesseract.image_to_string(img)
|
142 |
st.subheader("Summarized Text")
|
143 |
engsum(text)
|
|
|
149 |
img = cv2.imread("img.png")
|
150 |
#text = pytesseract.image_to_string(img) if st.checkbox("Bangla") else pytesseract.image_to_string(img, lang="ben")
|
151 |
st.text("Select the summarization type:")
|
152 |
+
if st.button("Bangla"):
|
|
|
153 |
text = pytesseract.image_to_string(img, lang="ben")
|
154 |
st.subheader("সারাংশ/সারমর্ম")
|
155 |
bansum(text)
|
156 |
+
if st.button("English"):
|
157 |
text=pytesseract.image_to_string(img)
|
158 |
st.subheader("Summarized Text")
|
159 |
engsum(text)
|
160 |
else:
|
161 |
text=None
|
162 |
text = message
|
163 |
+
if st.button("Bangla"):
|
|
|
164 |
bansum(text)
|
165 |
+
if st.button("English"):
|
166 |
engsum(text)
|
167 |
if st.checkbox("Conversate"):
|
168 |
with st.container():
|