shukdevdatta123 commited on
Commit
3ce2003
·
verified ·
1 Parent(s): 7b791f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -183,6 +183,7 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
183
  image_input = gr.Image(type="pil", label="Upload an image for environmental analysis")
184
  image_submit = gr.Button("Analyze Image")
185
  image_output = gr.Textbox(label="Analysis Results", lines=15)
 
186
 
187
  image_submit.click(
188
  analyze_environmental_impact,
@@ -196,11 +197,18 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
196
  ],
197
  outputs=image_output
198
  )
 
 
 
 
 
 
199
 
200
  with gr.TabItem("Geographical Assessment"):
201
  location_input = gr.Textbox(label="Location (city, region, or country)", placeholder="e.g., Paris, France")
202
  location_submit = gr.Button("Analyze Location")
203
  location_output = gr.Textbox(label="Analysis Results", lines=15)
 
204
 
205
  location_submit.click(
206
  analyze_environmental_impact,
@@ -215,6 +223,12 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
215
  outputs=location_output
216
  )
217
 
 
 
 
 
 
 
218
  with gr.TabItem("Product Assessment"):
219
  product_info = gr.Textbox(
220
  label="Product Information",
@@ -223,6 +237,7 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
223
  )
224
  product_submit = gr.Button("Analyze Product")
225
  product_output = gr.Textbox(label="Analysis Results", lines=15)
 
226
 
227
  product_submit.click(
228
  analyze_environmental_impact,
@@ -237,6 +252,12 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
237
  outputs=product_output
238
  )
239
 
 
 
 
 
 
 
240
  with gr.TabItem("Custom Query"):
241
  custom_input = gr.Textbox(
242
  label="Custom Environmental Query",
@@ -245,6 +266,7 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
245
  )
246
  custom_submit = gr.Button("Analyze")
247
  custom_output = gr.Textbox(label="Analysis Results", lines=15)
 
248
 
249
  custom_submit.click(
250
  analyze_environmental_impact,
@@ -258,6 +280,12 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
258
  ],
259
  outputs=custom_output
260
  )
 
 
 
 
 
 
261
 
262
  gr.Markdown("""
263
  ### Privacy Notice
@@ -273,4 +301,4 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
273
 
274
  # Launch the app
275
  if __name__ == "__main__":
276
- app.launch()
 
183
  image_input = gr.Image(type="pil", label="Upload an image for environmental analysis")
184
  image_submit = gr.Button("Analyze Image")
185
  image_output = gr.Textbox(label="Analysis Results", lines=15)
186
+ image_clear = gr.Button("Clear Response")
187
 
188
  image_submit.click(
189
  analyze_environmental_impact,
 
197
  ],
198
  outputs=image_output
199
  )
200
+
201
+ image_clear.click(
202
+ lambda: "",
203
+ inputs=[],
204
+ outputs=image_output
205
+ )
206
 
207
  with gr.TabItem("Geographical Assessment"):
208
  location_input = gr.Textbox(label="Location (city, region, or country)", placeholder="e.g., Paris, France")
209
  location_submit = gr.Button("Analyze Location")
210
  location_output = gr.Textbox(label="Analysis Results", lines=15)
211
+ location_clear = gr.Button("Clear Response")
212
 
213
  location_submit.click(
214
  analyze_environmental_impact,
 
223
  outputs=location_output
224
  )
225
 
226
+ location_clear.click(
227
+ lambda: "",
228
+ inputs=[],
229
+ outputs=location_output
230
+ )
231
+
232
  with gr.TabItem("Product Assessment"):
233
  product_info = gr.Textbox(
234
  label="Product Information",
 
237
  )
238
  product_submit = gr.Button("Analyze Product")
239
  product_output = gr.Textbox(label="Analysis Results", lines=15)
240
+ product_clear = gr.Button("Clear Response")
241
 
242
  product_submit.click(
243
  analyze_environmental_impact,
 
252
  outputs=product_output
253
  )
254
 
255
+ product_clear.click(
256
+ lambda: "",
257
+ inputs=[],
258
+ outputs=product_output
259
+ )
260
+
261
  with gr.TabItem("Custom Query"):
262
  custom_input = gr.Textbox(
263
  label="Custom Environmental Query",
 
266
  )
267
  custom_submit = gr.Button("Analyze")
268
  custom_output = gr.Textbox(label="Analysis Results", lines=15)
269
+ custom_clear = gr.Button("Clear Response")
270
 
271
  custom_submit.click(
272
  analyze_environmental_impact,
 
280
  ],
281
  outputs=custom_output
282
  )
283
+
284
+ custom_clear.click(
285
+ lambda: "",
286
+ inputs=[],
287
+ outputs=custom_output
288
+ )
289
 
290
  gr.Markdown("""
291
  ### Privacy Notice
 
301
 
302
  # Launch the app
303
  if __name__ == "__main__":
304
+ app.launch()