pragnakalp commited on
Commit
b5b0696
·
1 Parent(s): 59003ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
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, Image
16
  from PIL import Image
17
  from paddleocr import PaddleOCR
18
  import socket
@@ -135,6 +135,7 @@ def generate_ocr(Method,img):
135
 
136
  new_data=img.reshape(img.shape)
137
  imge = Image.fromarray(new_data.astype(np.uint8),'RGB')
 
138
  add_csv = [Method,img,text_output]
139
 
140
  with open(DATA_FILE, "a") as f:
@@ -143,11 +144,11 @@ def generate_ocr(Method,img):
143
  writer.writerow(add_csv)
144
  commit_url = repo.push_to_hub()
145
  print(commit_url)
146
- # try:
147
- # dataset = load_dataset("pragnakalp/OCR-img-to-text", data_files= "ocr_data.csv", streaming=True)
148
- # print(dataset)
149
- # except Exception as e:
150
- # print("error in loading data",e)
151
 
152
 
153
  # with open(DATA_FILE, "a") as csvfile:
 
12
  from datetime import datetime
13
  import scipy.ndimage.interpolation as inter
14
  import easyocr
15
+ from datasets import load_dataset, Image, Features, Array3D
16
  from PIL import Image
17
  from paddleocr import PaddleOCR
18
  import socket
 
135
 
136
  new_data=img.reshape(img.shape)
137
  imge = Image.fromarray(new_data.astype(np.uint8),'RGB')
138
+ feature = Image()
139
  add_csv = [Method,img,text_output]
140
 
141
  with open(DATA_FILE, "a") as f:
 
144
  writer.writerow(add_csv)
145
  commit_url = repo.push_to_hub()
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.features)
150
+ except Exception as e:
151
+ print("error in loading data",e)
152
 
153
 
154
  # with open(DATA_FILE, "a") as csvfile: