acvss24 commited on
Commit
026a257
·
verified ·
1 Parent(s): c67e3e0
Files changed (1) hide show
  1. app.py +28 -9
app.py CHANGED
@@ -16,16 +16,35 @@ with gr.Blocks() as app:
16
  "This app generates text for a given image related to nutrition in three low-resource languages")
17
 
18
  with gr.Row():
19
- inputs=[
20
- gr.Image(type="pil", label="Upload an Image")
21
 
22
- ],
23
  with gr.Row():
24
- outputs=[
25
- gr.Text(label="English: "),
26
- gr.Text(label="Yoruba: "),
27
- gr.Text(label="Swahili: "),
28
- gr.Text(label="Twi: ")
29
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  app.launch()
 
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
+ with gr.Row():
28
+ submit_btn = gr.Button("Submit")
29
+ clear_btn = gr.Button("Clear")
30
+
31
+ def process_image(image):
32
+
33
+ return "English text", "Yoruba text", "Swahili text", "Twi text"
34
+
35
+ def clear_outputs():
36
+ return None, "", "", "", ""
37
+
38
+ submit_btn.click(
39
+ fn=process_image,
40
+ inputs=[image_input],
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()