Commit
·
4f50644
1
Parent(s):
00bb0bd
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,7 +122,7 @@ Generate OCR
|
|
| 122 |
def generate_ocr(Method,img):
|
| 123 |
try:
|
| 124 |
text_output = ''
|
| 125 |
-
|
| 126 |
print("Method___________________",Method)
|
| 127 |
if Method == 'EasyOCR':
|
| 128 |
text_output = ocr_with_easy(img)
|
|
@@ -135,11 +135,10 @@ def generate_ocr(Method,img):
|
|
| 135 |
print("^^^^^^^^^^^^^^^",new_data)
|
| 136 |
imge = Image.fromarray(new_data.astype(np.uint8),'RGB')
|
| 137 |
# imge.show()
|
|
|
|
| 138 |
with open(DATA_FILE, "a") as csvfile:
|
| 139 |
-
writer = csv.
|
| 140 |
-
writer.writerow(
|
| 141 |
-
{"method": Method, "image": imge, "generated_text": text_output}
|
| 142 |
-
)
|
| 143 |
commit_url = repo.push_to_hub()
|
| 144 |
print(commit_url)
|
| 145 |
# save_details(Method,text_output,img)
|
|
|
|
| 122 |
def generate_ocr(Method,img):
|
| 123 |
try:
|
| 124 |
text_output = ''
|
| 125 |
+
add_csv = []
|
| 126 |
print("Method___________________",Method)
|
| 127 |
if Method == 'EasyOCR':
|
| 128 |
text_output = ocr_with_easy(img)
|
|
|
|
| 135 |
print("^^^^^^^^^^^^^^^",new_data)
|
| 136 |
imge = Image.fromarray(new_data.astype(np.uint8),'RGB')
|
| 137 |
# imge.show()
|
| 138 |
+
add_csv = [Method,imge,text_output]
|
| 139 |
with open(DATA_FILE, "a") as csvfile:
|
| 140 |
+
writer = csv.Writer(csvfile)
|
| 141 |
+
writer.writerow(add_csv)
|
|
|
|
|
|
|
| 142 |
commit_url = repo.push_to_hub()
|
| 143 |
print(commit_url)
|
| 144 |
# save_details(Method,text_output,img)
|