Commit
·
25ad790
1
Parent(s):
021ef04
Adding image module to app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
|
3 |
from backend.text_to_tgt import src_txt_to_eng_translator
|
4 |
from backend.audio_to_tgt import src_audio_to_eng_translator
|
5 |
-
from backend.image_to_tgt import src_image_to_eng_translator
|
6 |
# from backend.video_to_tgt import src_video_to_eng_translator
|
7 |
|
8 |
heading_txt = "Text-to-English"
|
@@ -21,10 +21,18 @@ txt_interface = gr.Interface(
|
|
21 |
heading_image = "Image-to-English"
|
22 |
description_image = "Upload an image to extract text and translate it to English."
|
23 |
|
|
|
|
|
24 |
image_interface = gr.Interface(
|
25 |
fn=src_image_to_eng_translator,
|
26 |
-
inputs=
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
title="Image Text Extractor and Translator",
|
29 |
description=description_image,
|
30 |
)
|
|
|
2 |
|
3 |
from backend.text_to_tgt import src_txt_to_eng_translator
|
4 |
from backend.audio_to_tgt import src_audio_to_eng_translator
|
5 |
+
from backend.image_to_tgt import src_image_to_eng_translator, language_dict
|
6 |
# from backend.video_to_tgt import src_video_to_eng_translator
|
7 |
|
8 |
heading_txt = "Text-to-English"
|
|
|
21 |
heading_image = "Image-to-English"
|
22 |
description_image = "Upload an image to extract text and translate it to English."
|
23 |
|
24 |
+
sorted_languages = sorted(language_dict.keys())
|
25 |
+
|
26 |
image_interface = gr.Interface(
|
27 |
fn=src_image_to_eng_translator,
|
28 |
+
inputs=[
|
29 |
+
gr.Image(label="Upload an Image", type="filepath"),
|
30 |
+
gr.Dropdown(choices=sorted_languages, label="Select Language", default='English')
|
31 |
+
],
|
32 |
+
outputs=[
|
33 |
+
gr.Textbox(label="Image Text"),
|
34 |
+
gr.Textbox(label="Translated Text")
|
35 |
+
],,
|
36 |
title="Image Text Extractor and Translator",
|
37 |
description=description_image,
|
38 |
)
|