Spaces:
Runtime error
Runtime error
DerrylNessie
commited on
Commit
•
93a5f8a
1
Parent(s):
f16ccdd
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from PIL import ImageDraw
|
|
5 |
import gradio as gr
|
6 |
import torch
|
7 |
import easyocr
|
8 |
-
import cv2
|
9 |
import math
|
10 |
import numpy as np
|
11 |
|
@@ -39,12 +39,17 @@ def inference(img, lang):
|
|
39 |
mask = Image.new("L", im.size, 0)
|
40 |
|
41 |
draw_mask(mask, bounds)
|
42 |
-
|
43 |
#remove_text(im, mask, bounds)
|
44 |
lang = ""
|
45 |
im.save('result.jpg')
|
46 |
mask.save('mask.png')
|
47 |
#img_inpainted.save('inpaint.jpg')
|
|
|
|
|
|
|
|
|
|
|
48 |
return ['result.jpg', 'mask.png', pd.DataFrame(bounds). iloc[: , 1:2]]
|
49 |
|
50 |
title = 'EasyOCR'
|
|
|
5 |
import gradio as gr
|
6 |
import torch
|
7 |
import easyocr
|
8 |
+
import cv2 as cv
|
9 |
import math
|
10 |
import numpy as np
|
11 |
|
|
|
39 |
mask = Image.new("L", im.size, 0)
|
40 |
|
41 |
draw_mask(mask, bounds)
|
42 |
+
img_inpainted = cv2.inpaint(im, mask, 7, cv2.INPAINT_NS)
|
43 |
#remove_text(im, mask, bounds)
|
44 |
lang = ""
|
45 |
im.save('result.jpg')
|
46 |
mask.save('mask.png')
|
47 |
#img_inpainted.save('inpaint.jpg')
|
48 |
+
img = cv.imread('result.jpg')
|
49 |
+
mask = cv.imread('mask.png',0)
|
50 |
+
dst = cv.inpaint(img,mask,3,cv.INPAINT_TELEA)
|
51 |
+
#img_inpainted = cv2.inpaint(im, mask, 7, cv2.INPAINT_TELEA)
|
52 |
+
#dst.save('dst.jpg')
|
53 |
return ['result.jpg', 'mask.png', pd.DataFrame(bounds). iloc[: , 1:2]]
|
54 |
|
55 |
title = 'EasyOCR'
|