Omnibus commited on
Commit
98046f7
β€’
1 Parent(s): e9eef4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -10,6 +10,7 @@ import os
10
  from PIL import ImageFont, ImageDraw, Image
11
 
12
  lang_id = {
 
13
  "Afrikaans": "af",
14
  "Amharic": "am",
15
  "Arabic": "ar",
@@ -211,7 +212,7 @@ def blur_im(img,bounds):
211
  w = int(p2[0]) - int(x)
212
  h = int(p2[1]) - int(y)
213
  kernel = np.ones((3, 3), np.uint8)
214
- im[y:y+h, x:x+w] = cv2.dilate(im[y:y+h, x:x+w], kernel, iterations=6)
215
  im[y:y+h, x:x+w] = cv2.GaussianBlur(im[y:y+h, x:x+w],(51,51),0)
216
 
217
 
@@ -267,20 +268,18 @@ with gr.Blocks() as robot:
267
  with gr.Column():
268
  im=gr.Image(type="filepath")
269
  with gr.Column():
270
- with gr.Row():
271
- target_lang = gr.Dropdown(label="Detect language", choices=list(lang_id.keys()),value="English")
272
- target_lang2 = gr.Dropdown(label="Detect language", choices=list(lang_id.keys()),value="")
273
- go_btn=gr.Button()
274
  with gr.Row():
275
  with gr.Column():
276
  out_im=gr.Image()
277
  with gr.Column():
278
- out_txt=gr.Textbox(lines=8)
279
- data_f=gr.Dataframe()
280
  with gr.Row():
281
- with gr.Column():
282
- trans_im=gr.Image()
283
- gr.Column()
284
 
285
 
286
  go_btn.click(detect,[im,target_lang,target_lang2],[out_im,trans_im,out_txt,data_f])
 
10
  from PIL import ImageFont, ImageDraw, Image
11
 
12
  lang_id = {
13
+ "":"",
14
  "Afrikaans": "af",
15
  "Amharic": "am",
16
  "Arabic": "ar",
 
212
  w = int(p2[0]) - int(x)
213
  h = int(p2[1]) - int(y)
214
  kernel = np.ones((3, 3), np.uint8)
215
+ im[y:y+h, x:x+w] = cv2.dilate(im[y:y+h, x:x+w], kernel, iterations=3)
216
  im[y:y+h, x:x+w] = cv2.GaussianBlur(im[y:y+h, x:x+w],(51,51),0)
217
 
218
 
 
268
  with gr.Column():
269
  im=gr.Image(type="filepath")
270
  with gr.Column():
271
+ target_lang = gr.Dropdown(label="Detect language", choices=list(lang_id.keys()),value="English")
272
+ target_lang2 = gr.Dropdown(label="Detect language2", choices=list(lang_id.keys()),value="")
273
+ go_btn=gr.Button()
 
274
  with gr.Row():
275
  with gr.Column():
276
  out_im=gr.Image()
277
  with gr.Column():
278
+ trans_im=gr.Image()
279
+
280
  with gr.Row():
281
+ out_txt=gr.Textbox(lines=8)
282
+ data_f=gr.Dataframe()
 
283
 
284
 
285
  go_btn.click(detect,[im,target_lang,target_lang2],[out_im,trans_im,out_txt,data_f])