Spaces:
Build error
Build error
interface update
Browse files
app.py
CHANGED
|
@@ -2,49 +2,24 @@ import gradio as gr
|
|
| 2 |
import PIL.Image as Image
|
| 3 |
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
with gr.Row():
|
| 12 |
-
Title
|
| 13 |
-
|
| 14 |
-
with gr.Row():
|
| 15 |
-
gr.Markdown(
|
| 16 |
-
"This app generates text for a given image related to nutrition in three low-resource languages")
|
| 17 |
-
|
| 18 |
-
with gr.Row():
|
| 19 |
-
image_input = gr.Image(type="pil", label="Upload an Image")
|
| 20 |
-
|
| 21 |
-
with gr.Row():
|
| 22 |
-
english_output = gr.Text(label="English: ")
|
| 23 |
-
yoruba_output = gr.Text(label="Yoruba: ")
|
| 24 |
-
swahili_output = gr.Text(label="Swahili: ")
|
| 25 |
-
twi_output = gr.Text(label="Twi: ")
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
outputs=[english_output, yoruba_output, swahili_output, twi_output]
|
| 42 |
-
)
|
| 43 |
-
|
| 44 |
-
clear_btn.click(
|
| 45 |
-
fn=clear_outputs,
|
| 46 |
-
inputs=[],
|
| 47 |
-
outputs=[image_input, english_output, yoruba_output, swahili_output, twi_output]
|
| 48 |
-
)
|
| 49 |
|
| 50 |
-
app.launch()
|
|
|
|
| 2 |
import PIL.Image as Image
|
| 3 |
|
| 4 |
|
| 5 |
+
def process_image(image):
|
| 6 |
+
return "English text","Yoruba text", "Swahili text", "Twi text"
|
| 7 |
+
app = gr.Interface(
|
| 8 |
+
fn=process_image,
|
| 9 |
+
inputs = gr.Image(type="pil", label="Upload an Image"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
outputs = [
|
| 12 |
+
gr.Text(label="English: "),
|
| 13 |
+
gr.Text(label="Yoruba: "),
|
| 14 |
+
gr.Text(label="Swahili: "),
|
| 15 |
+
gr.Text(label="Twi: "),
|
| 16 |
+
],
|
| 17 |
+
title="Nutri Assistant App",
|
| 18 |
+
description="This app generates text for a given image related to nutrition in three low-resource languages",
|
| 19 |
+
examples =[["spaghetti.png"],
|
| 20 |
+
["cake.png"]],
|
| 21 |
+
|
| 22 |
+
)
|
| 23 |
+
if __name__ == "__main__":
|
| 24 |
+
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
|
|