Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
-
os.system('pip install paddlepaddle')
|
3 |
-
os.system('pip install paddleocr')
|
4 |
from paddleocr import PaddleOCR, draw_ocr
|
5 |
from PIL import Image
|
6 |
import gradio as gr
|
@@ -52,7 +52,7 @@ def solve(file_obj):
|
|
52 |
|
53 |
# Bonus: make an image and then use OCR
|
54 |
# to extract the text.
|
55 |
-
img = np.array([[c
|
56 |
plt.imshow(img, cmap="binary")
|
57 |
plt.axis('off')
|
58 |
plt.savefig("day_10.png")
|
|
|
1 |
import os
|
2 |
+
# os.system('pip install paddlepaddle')
|
3 |
+
# os.system('pip install paddleocr')
|
4 |
from paddleocr import PaddleOCR, draw_ocr
|
5 |
from PIL import Image
|
6 |
import gradio as gr
|
|
|
52 |
|
53 |
# Bonus: make an image and then use OCR
|
54 |
# to extract the text.
|
55 |
+
img = np.array([[1 if c == PIXEL else 0 for c in crt[i:i+DISPLAY_WIDTH]] for i in range(0, len(crt), DISPLAY_WIDTH)])
|
56 |
plt.imshow(img, cmap="binary")
|
57 |
plt.axis('off')
|
58 |
plt.savefig("day_10.png")
|