Spaces:
Build error
Build error
Commit
·
e8fc64a
1
Parent(s):
6a33dbc
Upload folder using huggingface_hub
Browse files- app/images/idcards/input.jpg +0 -0
- deploy.py +4 -4
app/images/idcards/input.jpg
CHANGED
![]() |
![]() |
deploy.py
CHANGED
@@ -16,11 +16,11 @@ def ocr(image_input, webcam_input, card_type_input):
|
|
16 |
print("Webcam Image : ", type(webcam_input))
|
17 |
|
18 |
if image_input is not None and image_input.any():
|
19 |
-
print("In input image")
|
20 |
cv2.imwrite(file_path, image_input)
|
21 |
else:
|
22 |
print("In webcam")
|
23 |
-
cv2.imwrite(file_path, webcam_input)
|
24 |
|
25 |
# print(type(input_img))
|
26 |
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
|
@@ -29,7 +29,7 @@ def ocr(image_input, webcam_input, card_type_input):
|
|
29 |
|
30 |
# with open(file_path, "wb+") as file_object:
|
31 |
# file_object.write(input_img.file.read())
|
32 |
-
|
33 |
dictionary = custom_ocr(file_path, card_type_input)
|
34 |
|
35 |
if '' in list(dictionary.values()):
|
@@ -68,7 +68,7 @@ def ocr(image_input, webcam_input, card_type_input):
|
|
68 |
print("Updated Dict ",dictionary)
|
69 |
response = {"Status" : 200, "OCR" : dictionary}
|
70 |
return response
|
71 |
-
|
72 |
# Define the input objects
|
73 |
image_input = gr.inputs.Image(label="Upload Image")
|
74 |
webcam_input = gr.inputs.Image(label="Webcam", source="webcam")
|
|
|
16 |
print("Webcam Image : ", type(webcam_input))
|
17 |
|
18 |
if image_input is not None and image_input.any():
|
19 |
+
print("In input image")
|
20 |
cv2.imwrite(file_path, image_input)
|
21 |
else:
|
22 |
print("In webcam")
|
23 |
+
cv2.imwrite(file_path, cv2.flip(webcam_input, 1))
|
24 |
|
25 |
# print(type(input_img))
|
26 |
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
|
|
|
29 |
|
30 |
# with open(file_path, "wb+") as file_object:
|
31 |
# file_object.write(input_img.file.read())
|
32 |
+
|
33 |
dictionary = custom_ocr(file_path, card_type_input)
|
34 |
|
35 |
if '' in list(dictionary.values()):
|
|
|
68 |
print("Updated Dict ",dictionary)
|
69 |
response = {"Status" : 200, "OCR" : dictionary}
|
70 |
return response
|
71 |
+
|
72 |
# Define the input objects
|
73 |
image_input = gr.inputs.Image(label="Upload Image")
|
74 |
webcam_input = gr.inputs.Image(label="Webcam", source="webcam")
|