Spaces:
Build error
Build error
ShahzainHaider
commited on
Commit
·
01162ca
1
Parent(s):
7bbae49
Upload folder using huggingface_hub
Browse files- app/images/idcards/input.jpg +0 -0
- deploy.py +25 -6
- flagged/Input Image/tmp304mlnni.png +0 -0
- flagged/component 1/tmpyy_giqip.jpg +0 -0
- flagged/log.csv +2 -0
app/images/idcards/input.jpg
CHANGED
deploy.py
CHANGED
@@ -10,13 +10,25 @@ from paddleocr import PaddleOCR
|
|
10 |
from app.layoutLM_api.api import custom_ocr
|
11 |
import cv2
|
12 |
|
13 |
-
def ocr(
|
14 |
-
print(type(input_img))
|
15 |
-
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
|
16 |
|
17 |
file_path = 'app/images/idcards/input.jpg'
|
18 |
-
cv2.imwrite(file_path, input_img)
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# with open(file_path, "wb+") as file_object:
|
21 |
# file_object.write(input_img.file.read())
|
22 |
|
@@ -59,5 +71,12 @@ def ocr(input_img):
|
|
59 |
response = {"Status" : 200, "OCR" : dictionary}
|
60 |
return response
|
61 |
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
from app.layoutLM_api.api import custom_ocr
|
11 |
import cv2
|
12 |
|
13 |
+
def ocr(image_input, webcam_input):
|
|
|
|
|
14 |
|
15 |
file_path = 'app/images/idcards/input.jpg'
|
|
|
16 |
|
17 |
+
print("image_input : ", type(image_input))
|
18 |
+
print("Webcam Image : ", type(webcam_input))
|
19 |
+
|
20 |
+
if image_input is not None and image_input.any():
|
21 |
+
print("In input image")
|
22 |
+
cv2.imwrite(file_path, image_input)
|
23 |
+
else:
|
24 |
+
print("In webcam")
|
25 |
+
cv2.imwrite(file_path, webcam_input)
|
26 |
+
|
27 |
+
# print(type(input_img))
|
28 |
+
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
# with open(file_path, "wb+") as file_object:
|
33 |
# file_object.write(input_img.file.read())
|
34 |
|
|
|
71 |
response = {"Status" : 200, "OCR" : dictionary}
|
72 |
return response
|
73 |
|
74 |
+
# webcam_checkbox = gr.inputs.Checkbox(label="Use webcam", optional=True)
|
75 |
+
|
76 |
+
# Define the input objects
|
77 |
+
image_input = gr.inputs.Image(label="Upload Image")
|
78 |
+
webcam_input = gr.inputs.Image(label="Webcam", source="webcam")
|
79 |
+
|
80 |
+
# Create the Gradio interface
|
81 |
+
interface = gr.Interface(fn=ocr, inputs=[image_input, webcam_input], outputs="json")
|
82 |
+
interface.launch(share=True)
|
flagged/Input Image/tmp304mlnni.png
ADDED
flagged/component 1/tmpyy_giqip.jpg
ADDED
flagged/log.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Input Image,component 1,output,flag,username,timestamp
|
2 |
+
/home/shahzain/Documents/Voltox Ai Servers/OCR/flagged/Input Image/tmp304mlnni.png,/home/shahzain/Documents/Voltox Ai Servers/OCR/flagged/component 1/tmpyy_giqip.jpg,,,,2023-06-06 11:50:58.232590
|