Spaces:
Running
Running
pragnakalp
commited on
Commit
•
e0a4914
1
Parent(s):
fee2b35
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from huggingface_hub import Repository
|
|
12 |
from datetime import datetime
|
13 |
import scipy.ndimage.interpolation as inter
|
14 |
import easyocr
|
15 |
-
from datasets import load_dataset
|
16 |
from PIL import Image
|
17 |
from paddleocr import PaddleOCR
|
18 |
import socket
|
@@ -133,10 +133,9 @@ def generate_ocr(Method,img):
|
|
133 |
text_output = ocr_with_paddle(img)
|
134 |
|
135 |
new_data=img.reshape(img.shape)
|
136 |
-
# print("^^^^^^^^^^^^^^^",new_data)
|
137 |
imge = Image.fromarray(new_data.astype(np.uint8),'RGB')
|
138 |
add_csv = [Method,imge,text_output]
|
139 |
-
|
140 |
# with open(DATA_FILE, "a") as f:
|
141 |
# writer = csv.writer(f)
|
142 |
# write the data
|
@@ -146,6 +145,8 @@ def generate_ocr(Method,img):
|
|
146 |
print(commit_url)
|
147 |
try:
|
148 |
dataset = load_dataset("pragnakalp/OCR-img-to-text", data_files= "ocr_data.csv", streaming=True)
|
|
|
|
|
149 |
print(dataset)
|
150 |
except Exception as e:
|
151 |
print("error in loading data",e)
|
|
|
12 |
from datetime import datetime
|
13 |
import scipy.ndimage.interpolation as inter
|
14 |
import easyocr
|
15 |
+
from datasets import load_dataset, Image
|
16 |
from PIL import Image
|
17 |
from paddleocr import PaddleOCR
|
18 |
import socket
|
|
|
133 |
text_output = ocr_with_paddle(img)
|
134 |
|
135 |
new_data=img.reshape(img.shape)
|
|
|
136 |
imge = Image.fromarray(new_data.astype(np.uint8),'RGB')
|
137 |
add_csv = [Method,imge,text_output]
|
138 |
+
|
139 |
# with open(DATA_FILE, "a") as f:
|
140 |
# writer = csv.writer(f)
|
141 |
# write the data
|
|
|
145 |
print(commit_url)
|
146 |
try:
|
147 |
dataset = load_dataset("pragnakalp/OCR-img-to-text", data_files= "ocr_data.csv", streaming=True)
|
148 |
+
dataset = load_dataset("data", split="train")
|
149 |
+
print("()()()()",dataset[0]["image"])
|
150 |
print(dataset)
|
151 |
except Exception as e:
|
152 |
print("error in loading data",e)
|