osanseviero commited on
Commit
ce75747
·
verified ·
1 Parent(s): 10364bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -110,4 +110,28 @@ iface = gr.Interface(
110
  #],
111
  )
112
 
113
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  #],
111
  )
112
 
113
+ markdown = """# CO2 Estimation
114
+
115
+ Upload an image and get an **estimation** of the CO2 involved in the activities depicted. This is a very rough estimate, and can be misleading or factually inaccurate. Take this as a demo project and not as scientific/exact results.
116
+
117
+ Powered by [the Gemini API](https://ai.google.dev/gemini-api/docs) and [AI Studio](https://aistudio.google.com/).
118
+ """
119
+
120
+ with gr.Blocks() as demo:
121
+ with gr.Row():
122
+ gr.Markdown(markdown)
123
+ with gr.Row():
124
+ input_image = gr.Image(type="pil", label="Input Image")
125
+ output_image = gr.AnnotatedImage(label="Output Image")
126
+ with gr.Row():
127
+ output_dataframe = gr.Dataframe(
128
+ label="CO2 Estimated Data",
129
+ interactive=False,
130
+ headers=["co2", "item_name", "rationale"]
131
+ )
132
+
133
+ input_image.change(
134
+ fn=estimate_co2,
135
+ inputs=input_image,
136
+ outputs=[output_image, output_dataframe]
137
+ )