yalouini commited on
Commit
01b57fb
1 Parent(s): 5c2d8e2
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -57,8 +57,6 @@ def solve(file_obj):
57
  plt.imshow(img, cmap="binary")
58
  plt.axis('off')
59
  plt.savefig("day_10.png")
60
-
61
- print(ocr.ocr("day_10.png"))
62
  img_path = "day_10.png"
63
  ocr = PaddleOCR(use_angle_cls=True, use_gpu=False)
64
  result = ocr.ocr(img_path, cls=True)[0]
@@ -70,16 +68,16 @@ def solve(file_obj):
70
  font_path='simfang.ttf')
71
  im_show = Image.fromarray(im_show)
72
  im_show.save('result.jpg')
73
- return 'result.jpg'
74
 
75
- title = 'PaddleOCR'
76
  description = 'Day 10 2022 AoC using OCR!!!'
77
  article = "<p style='text-align: center'>Day 10 2022 AoC using OCR!!!</p>"
78
  css = ".output_image {height: 40rem !important; width: 100% !important;}"
79
  gr.Interface(
80
  solve,
81
  [gr.File(file_types='text', label='Input')],
82
- gr.outputs.Image(type='file', label='Output'),
83
  title=title,
84
  description=description,
85
  article=article,
 
57
  plt.imshow(img, cmap="binary")
58
  plt.axis('off')
59
  plt.savefig("day_10.png")
 
 
60
  img_path = "day_10.png"
61
  ocr = PaddleOCR(use_angle_cls=True, use_gpu=False)
62
  result = ocr.ocr(img_path, cls=True)[0]
 
68
  font_path='simfang.ttf')
69
  im_show = Image.fromarray(im_show)
70
  im_show.save('result.jpg')
71
+ return 'result.jpg', 'day_10.png'
72
 
73
+ title = 'Cathode-Ray Tube'
74
  description = 'Day 10 2022 AoC using OCR!!!'
75
  article = "<p style='text-align: center'>Day 10 2022 AoC using OCR!!!</p>"
76
  css = ".output_image {height: 40rem !important; width: 100% !important;}"
77
  gr.Interface(
78
  solve,
79
  [gr.File(file_types='text', label='Input')],
80
+ [gr.outputs.Image(type='file', label='Output_1'), gr.outputs.Image(type='file', label='Output_2')],
81
  title=title,
82
  description=description,
83
  article=article,