Spaces:
Sleeping
Sleeping
pragnakalp
commited on
Commit
•
3c29c5e
1
Parent(s):
28f43ce
Update app.py
Browse files
app.py
CHANGED
@@ -12,9 +12,9 @@ import easyocr
|
|
12 |
from PIL import Image
|
13 |
from paddleocr import PaddleOCR
|
14 |
import socket
|
15 |
-
from send_email_user import send_user_email
|
16 |
from huggingface_hub import HfApi
|
17 |
-
|
18 |
# api = HfApi()
|
19 |
# api.upload_folder(
|
20 |
# folder_path="/media/pragnakalpl20/Projects/Pragnakalp_projects/gradio_demo/images",
|
@@ -111,9 +111,24 @@ def generate_ocr(Method,img):
|
|
111 |
text_output = ocr_with_keras(img)
|
112 |
if Method == 'PaddleOCR':
|
113 |
text_output = ocr_with_paddle(img)
|
114 |
-
save_details(Method,text_output,img)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
# hostname = socket.gethostname()
|
118 |
# IPAddr = socket.gethostbyname(hostname)
|
119 |
# print(hostname)
|
@@ -121,7 +136,7 @@ def generate_ocr(Method,img):
|
|
121 |
except Exception as e:
|
122 |
print("Error in ocr generation ==>",e)
|
123 |
text_output = "Something went wrong"
|
124 |
-
|
125 |
"""
|
126 |
Save generated details
|
127 |
"""
|
|
|
12 |
from PIL import Image
|
13 |
from paddleocr import PaddleOCR
|
14 |
import socket
|
15 |
+
# from send_email_user import send_user_email
|
16 |
from huggingface_hub import HfApi
|
17 |
+
import smtplib
|
18 |
# api = HfApi()
|
19 |
# api.upload_folder(
|
20 |
# folder_path="/media/pragnakalpl20/Projects/Pragnakalp_projects/gradio_demo/images",
|
|
|
111 |
text_output = ocr_with_keras(img)
|
112 |
if Method == 'PaddleOCR':
|
113 |
text_output = ocr_with_paddle(img)
|
114 |
+
# save_details(Method,text_output,img)
|
115 |
+
sender="pragnakalp.dev33@gmail.com"
|
116 |
+
password="httscgatatbbxxur"
|
117 |
+
reciever="pragnakalp.dev35@gmail.com"
|
118 |
+
|
119 |
+
s = smtplib.SMTP('smtp.gmail.com', 587)
|
120 |
+
s.starttls()
|
121 |
+
s.login(sender,password)
|
122 |
+
|
123 |
|
124 |
+
message = """Subject : Appointment Booking\n\n
|
125 |
+
Hello,
|
126 |
+
Your OCR generated successfully"""
|
127 |
+
s.sendmail(sender, reciever, message)
|
128 |
+
s.quit()
|
129 |
+
mailsend=1
|
130 |
+
print("Send mail successfully")
|
131 |
+
# return text_output
|
132 |
# hostname = socket.gethostname()
|
133 |
# IPAddr = socket.gethostbyname(hostname)
|
134 |
# print(hostname)
|
|
|
136 |
except Exception as e:
|
137 |
print("Error in ocr generation ==>",e)
|
138 |
text_output = "Something went wrong"
|
139 |
+
return text_output
|
140 |
"""
|
141 |
Save generated details
|
142 |
"""
|