Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,15 +97,12 @@ def handle_userinput(user_question:str):
|
|
97 |
#return(full_text)
|
98 |
#################################################################################################################
|
99 |
def get_pdf_text(pdf_docs):
|
100 |
-
|
101 |
text = ""
|
102 |
for pdf in pdf_docs:
|
103 |
pdf_reader = PdfReader(pdf)
|
104 |
for page in pdf_reader.pages:
|
105 |
txt_page=page.extract_text()
|
106 |
-
|
107 |
-
result = translator.translate(txt_page)
|
108 |
-
text += result
|
109 |
return text
|
110 |
|
111 |
|
@@ -148,7 +145,10 @@ def main():
|
|
148 |
if pdf_docs:
|
149 |
# مسیر فایل آپلود شده را بدست آورید
|
150 |
txt_raw=get_pdf_text(pdf_docs)
|
151 |
-
|
|
|
|
|
|
|
152 |
if st.button("Process"):
|
153 |
with st.spinner("Processing"):
|
154 |
st.write(pdf_docs)
|
|
|
97 |
#return(full_text)
|
98 |
#################################################################################################################
|
99 |
def get_pdf_text(pdf_docs):
|
|
|
100 |
text = ""
|
101 |
for pdf in pdf_docs:
|
102 |
pdf_reader = PdfReader(pdf)
|
103 |
for page in pdf_reader.pages:
|
104 |
txt_page=page.extract_text()
|
105 |
+
text += txt_page
|
|
|
|
|
106 |
return text
|
107 |
|
108 |
|
|
|
145 |
if pdf_docs:
|
146 |
# مسیر فایل آپلود شده را بدست آورید
|
147 |
txt_raw=get_pdf_text(pdf_docs)
|
148 |
+
translator = GoogleTranslator(source='persian', target='english')
|
149 |
+
result = translator.translate(txt_raw)
|
150 |
+
st.write(result)
|
151 |
+
pdf_docs=result
|
152 |
if st.button("Process"):
|
153 |
with st.spinner("Processing"):
|
154 |
st.write(pdf_docs)
|