artificialguybr commited on
Commit
91099cf
·
verified ·
1 Parent(s): 6870916

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -26,7 +26,8 @@ def ocr_function(img, lang_name):
26
  print(f"OCR Function Called with lang_name: {lang_name}")
27
  lang_code = language_dict[lang_name]
28
  print(f"Language Code: {lang_code}")
29
- predictions = run_ocr([img], [lang_code], det_model, det_processor, rec_model, rec_processor)
 
30
  print(f"Predictions: {predictions}")
31
  if predictions:
32
  img_with_text = draw_polys_on_image(predictions[0]["polys"], img)
@@ -34,6 +35,7 @@ def ocr_function(img, lang_name):
34
  else:
35
  return img, "No text detected"
36
 
 
37
  def text_line_detection_function(img):
38
  print("Text Line Detection Function Called")
39
  preds = batch_detection([img], det_model, det_processor)[0]
 
26
  print(f"OCR Function Called with lang_name: {lang_name}")
27
  lang_code = language_dict[lang_name]
28
  print(f"Language Code: {lang_code}")
29
+ # Ensure langs is a list of language codes, not a list of lists
30
+ predictions = run_ocr([img], [lang_code], det_model, det_processor, rec_model, rec_processor) # Corrected
31
  print(f"Predictions: {predictions}")
32
  if predictions:
33
  img_with_text = draw_polys_on_image(predictions[0]["polys"], img)
 
35
  else:
36
  return img, "No text detected"
37
 
38
+
39
  def text_line_detection_function(img):
40
  print("Text Line Detection Function Called")
41
  preds = batch_detection([img], det_model, det_processor)[0]