Commit
·
9713d52
1
Parent(s):
645fa36
Add example images/audio, add example parameter in app.py
Browse files
app.py
CHANGED
|
@@ -15,11 +15,18 @@ txt_interface = gr.Interface(
|
|
| 15 |
],
|
| 16 |
outputs=gr.Textbox(label="Translation"),
|
| 17 |
title=heading_txt,
|
| 18 |
-
description=description_txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
)
|
| 20 |
|
| 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 |
|
|
@@ -38,10 +45,15 @@ image_interface = gr.Interface(
|
|
| 38 |
],
|
| 39 |
title="Image Text Extractor and Translator",
|
| 40 |
description=description_image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
)
|
| 42 |
|
| 43 |
heading_audio = "Audio-to-English"
|
| 44 |
-
description_audio = "Upload an audio file to extract text and translate it to English."
|
| 45 |
|
| 46 |
audio_interface = gr.Interface(
|
| 47 |
fn=src_audio_to_eng_translator,
|
|
@@ -55,7 +67,10 @@ audio_interface = gr.Interface(
|
|
| 55 |
gr.Textbox(label="Translated text"),
|
| 56 |
gr.Textbox(label="Original Language")],
|
| 57 |
title=heading_audio,
|
| 58 |
-
description=description_audio
|
|
|
|
|
|
|
|
|
|
| 59 |
)
|
| 60 |
combined_interface = gr.TabbedInterface(
|
| 61 |
[txt_interface, image_interface, audio_interface],
|
|
|
|
| 15 |
],
|
| 16 |
outputs=gr.Textbox(label="Translation"),
|
| 17 |
title=heading_txt,
|
| 18 |
+
description=description_txt,
|
| 19 |
+
examples=[
|
| 20 |
+
["Bonjour, comment ça va ?"],
|
| 21 |
+
["Привет, как дела?"],
|
| 22 |
+
["Hola, ¿cómo estás?"],
|
| 23 |
+
["你好,你怎么样?"],
|
| 24 |
+
["Guten Tag! Wie geht's dir?"]
|
| 25 |
+
]
|
| 26 |
)
|
| 27 |
|
| 28 |
heading_image = "Image-to-English"
|
| 29 |
+
description_image = "Upload an image to extract text and translate it to English. Make sure to choose language in 'Select Language'"
|
| 30 |
|
| 31 |
sorted_languages = sorted(language_dict.keys())
|
| 32 |
|
|
|
|
| 45 |
],
|
| 46 |
title="Image Text Extractor and Translator",
|
| 47 |
description=description_image,
|
| 48 |
+
examples=[
|
| 49 |
+
"examples/images/hindi_image_sample.jpg",
|
| 50 |
+
"examples/images/odia_sample_image.png",
|
| 51 |
+
"examples/images/russian_sample_image.png"
|
| 52 |
+
]
|
| 53 |
)
|
| 54 |
|
| 55 |
heading_audio = "Audio-to-English"
|
| 56 |
+
description_audio = "Upload an audio file to extract text and translate it to English. Takes too much time without GPU."
|
| 57 |
|
| 58 |
audio_interface = gr.Interface(
|
| 59 |
fn=src_audio_to_eng_translator,
|
|
|
|
| 67 |
gr.Textbox(label="Translated text"),
|
| 68 |
gr.Textbox(label="Original Language")],
|
| 69 |
title=heading_audio,
|
| 70 |
+
description=description_audio,
|
| 71 |
+
examples=[
|
| 72 |
+
"examples/audios/russian_sample_audio.mp3"
|
| 73 |
+
]
|
| 74 |
)
|
| 75 |
combined_interface = gr.TabbedInterface(
|
| 76 |
[txt_interface, image_interface, audio_interface],
|
examples/audios/russian_sample_audio.mp3
ADDED
|
Binary file (243 kB). View file
|
|
|
examples/images/hindi_image_sample.jpg
ADDED
|
examples/images/odia_sample_image.png
ADDED
|
examples/images/russian_sample_image.png
ADDED
|