Omnibus commited on
Commit
4f34618
β€’
1 Parent(s): 4b01ddd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -5,8 +5,7 @@ import easyocr
5
  import torch
6
  import cv2
7
  import PIL
8
- from PIL import Image
9
- from PIL import ImageDraw
10
 
11
  lang_id = {
12
  "Afrikaans": "af",
@@ -211,9 +210,15 @@ def blur_im(img,bounds):
211
  h = int(p2[1]) - int(y)
212
  kernel = np.ones((5, 5), np.uint8)
213
  im[y:y+h, x:x+w] = cv2.dilate(im[y:y+h, x:x+w], kernel, iterations=2)
214
-
215
  im[y:y+h, x:x+w] = cv2.GaussianBlur(im[y:y+h, x:x+w],(51,51),0)
216
-
 
 
 
 
 
 
 
217
  return im
218
 
219
  def draw_boxes(image, bounds, color='blue', width=1):
 
5
  import torch
6
  import cv2
7
  import PIL
8
+ from PIL import ImageFont, ImageDraw, Image
 
9
 
10
  lang_id = {
11
  "Afrikaans": "af",
 
210
  h = int(p2[1]) - int(y)
211
  kernel = np.ones((5, 5), np.uint8)
212
  im[y:y+h, x:x+w] = cv2.dilate(im[y:y+h, x:x+w], kernel, iterations=2)
 
213
  im[y:y+h, x:x+w] = cv2.GaussianBlur(im[y:y+h, x:x+w],(51,51),0)
214
+ #fontpath = "tamil/Latha.ttf"
215
+ text = "New Text"
216
+
217
+ #font = ImageFont.truetype(fontpath, 32)
218
+ #img_pil = Image.fromarray(img)
219
+ draw = ImageDraw.Draw(im)
220
+ draw.text((x+5, y+5),text, font = None)
221
+ #img_tamil = np.array(img_pil)
222
  return im
223
 
224
  def draw_boxes(image, bounds, color='blue', width=1):