Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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=
|
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 |
-
|
271 |
-
|
272 |
-
|
273 |
-
go_btn=gr.Button()
|
274 |
with gr.Row():
|
275 |
with gr.Column():
|
276 |
out_im=gr.Image()
|
277 |
with gr.Column():
|
278 |
-
|
279 |
-
|
280 |
with gr.Row():
|
281 |
-
|
282 |
-
|
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])
|