Update app.py
Browse files
app.py
CHANGED
@@ -87,12 +87,12 @@ def bansum(text):
|
|
87 |
def main():
|
88 |
import streamlit as st
|
89 |
import time
|
90 |
-
if "
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
with st.container():
|
97 |
message = c1.text_input("Type your text here!")
|
98 |
uploaded_photo=None
|
@@ -102,8 +102,10 @@ def main():
|
|
102 |
if c2.button("Stop camera"):
|
103 |
CaptureImage =False
|
104 |
if c3.button("Upload Images/PDFs"):
|
105 |
-
time.sleep(3)
|
106 |
uploaded_photo = c3.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
|
|
|
|
|
|
107 |
if st.session_state["photo"]=="done" or message:
|
108 |
if uploaded_photo and uploaded_photo.type=='application/pdf':
|
109 |
tet = read_pdf(uploaded_photo)
|
@@ -132,12 +134,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,24 +150,23 @@ 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():
|
171 |
from streamlit_chat import message as st_message
|
172 |
from transformers import BlenderbotTokenizer
|
|
|
87 |
def main():
|
88 |
import streamlit as st
|
89 |
import time
|
90 |
+
if st.checkbox("Summarize"):
|
91 |
+
if "photo" not in st.session_state:
|
92 |
+
st.session_state["photo"]="not done"
|
93 |
+
def change_photo_state():
|
94 |
+
st.session_state["photo"]="done"
|
95 |
+
c1, c2, c3 = st.columns([2,2,1])
|
96 |
with st.container():
|
97 |
message = c1.text_input("Type your text here!")
|
98 |
uploaded_photo=None
|
|
|
102 |
if c2.button("Stop camera"):
|
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 |
+
global Summarize
|
107 |
+
Summarize=True
|
108 |
+
time.sleep(3)
|
109 |
if st.session_state["photo"]=="done" or message:
|
110 |
if uploaded_photo and uploaded_photo.type=='application/pdf':
|
111 |
tet = read_pdf(uploaded_photo)
|
|
|
134 |
img = img.save("img.png")
|
135 |
img = cv2.imread("img.png")
|
136 |
st.text("Select the summarization type:")
|
137 |
+
if st.button("BENGALI"):
|
|
|
138 |
text = pytesseract.image_to_string(img, lang="ben")
|
139 |
st.subheader("সারাংশ/সারমর্ম")
|
140 |
bansum(text)
|
141 |
+
if st.button("ENGLISH"):
|
142 |
text=pytesseract.image_to_string(img)
|
143 |
st.subheader("Summarized Text")
|
144 |
engsum(text)
|
|
|
150 |
img = cv2.imread("img.png")
|
151 |
#text = pytesseract.image_to_string(img) if st.checkbox("Bangla") else pytesseract.image_to_string(img, lang="ben")
|
152 |
st.text("Select the summarization type:")
|
153 |
+
if st.button("Bangla"):
|
|
|
154 |
text = pytesseract.image_to_string(img, lang="ben")
|
155 |
st.subheader("সারাংশ/সারমর্ম")
|
156 |
bansum(text)
|
157 |
+
if st.button("English"):
|
158 |
text=pytesseract.image_to_string(img)
|
159 |
st.subheader("Summarized Text")
|
160 |
engsum(text)
|
161 |
else:
|
162 |
text=None
|
163 |
text = message
|
164 |
+
if st.button("Bangla"):
|
|
|
165 |
bansum(text)
|
166 |
+
if st.button("English"):
|
167 |
engsum(text)
|
168 |
if st.checkbox("Conversate"):
|
169 |
+
Summarize=False
|
170 |
with st.container():
|
171 |
from streamlit_chat import message as st_message
|
172 |
from transformers import BlenderbotTokenizer
|