DerrylNessie commited on
Commit
1cd4adb
1 Parent(s): 84d2ede

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -39,11 +39,13 @@ def inference(img, lang):
39
  mask = Image.new("L", im.size, 0)
40
 
41
  draw_mask(mask, bounds)
 
42
  #remove_text(im, mask, bounds)
43
  lang = ""
44
  im.save('result.jpg')
45
  mask.save('mask.jpg')
46
- return ['result.jpg', 'mask.jpg', pd.DataFrame(bounds). iloc[: , 1:2]]
 
47
 
48
  title = 'EasyOCR'
49
  description = 'Gradio demo for EasyOCR. EasyOCR demo supports 80+ languages.To use it, simply upload your image and choose a language from the dropdown menu, or click one of the examples to load them. Read more at the links below.'
@@ -59,7 +61,7 @@ choices = [
59
  gr.Interface(
60
  inference,
61
  [gr.inputs.Image(type='file', label='Input'),gr.inputs.Dropdown(choices, type="value", default="korean", label='language')],
62
- [gr.outputs.Image(type='file', label='Output'), gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe()],
63
  title=title,
64
  description=description,
65
  article=article,
 
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.jpg')
47
+ img_inpainted.save('inpaint.jpg')
48
+ return ['result.jpg', 'mask.jpg', 'inpaint.jpg', pd.DataFrame(bounds). iloc[: , 1:2]]
49
 
50
  title = 'EasyOCR'
51
  description = 'Gradio demo for EasyOCR. EasyOCR demo supports 80+ languages.To use it, simply upload your image and choose a language from the dropdown menu, or click one of the examples to load them. Read more at the links below.'
 
61
  gr.Interface(
62
  inference,
63
  [gr.inputs.Image(type='file', label='Input'),gr.inputs.Dropdown(choices, type="value", default="korean", label='language')],
64
+ [gr.outputs.Image(type='file', label='Output'), gr.outputs.Image(type='file', label='Output'), gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe()],
65
  title=title,
66
  description=description,
67
  article=article,