sotirios-slv commited on
Commit
4286a1e
1 Parent(s): cd373fc

Updated the excel export

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -38,8 +38,8 @@ def run(image, lang="eng"):
38
  print("Image ", image)
39
  try:
40
  print("Image filename ", image.filename)
41
- except:
42
- print("Could not print image filename")
43
  result = pytesseract.image_to_string(image, lang=None if lang == [] else lang)
44
 
45
  ner = get_named_entities(result)
@@ -58,14 +58,9 @@ def download_output(ocr_text: str, named_entities: str, image_name="test"):
58
  ner_df = pd.Series(named_entities_list)
59
 
60
  with pd.ExcelWriter(output_file) as writer:
61
- ocr_df.to_excel(
62
- writer, sheet_name="OCR text", columns=["OCR text"], index=False
63
- )
64
  ner_df.to_excel(
65
- writer,
66
- sheet_name="Named entities",
67
- columns=["Named entities"],
68
- index=False,
69
  )
70
  return output_file
71
 
 
38
  print("Image ", image)
39
  try:
40
  print("Image filename ", image.filename)
41
+ except Exception as e:
42
+ print(f"Could not print image filename: {e}")
43
  result = pytesseract.image_to_string(image, lang=None if lang == [] else lang)
44
 
45
  ner = get_named_entities(result)
 
58
  ner_df = pd.Series(named_entities_list)
59
 
60
  with pd.ExcelWriter(output_file) as writer:
61
+ ocr_df.to_excel(writer, sheet_name="OCR text", columns=["OCR text"])
 
 
62
  ner_df.to_excel(
63
+ writer, sheet_name="Named entities", columns=["Named entities"]
 
 
 
64
  )
65
  return output_file
66