shukdevdatta123 commited on
Commit
b93ab3f
·
verified ·
1 Parent(s): f074c2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -4
app.py CHANGED
@@ -170,6 +170,13 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
170
 
171
  api_key = gr.Textbox(label="OpenRouter API Key", placeholder="Enter your OpenRouter API key", type="password")
172
 
 
 
 
 
 
 
 
173
  with gr.Tabs():
174
  with gr.TabItem("Image Analysis"):
175
  image_input = gr.Image(type="pil", label="Upload an image for environmental analysis")
@@ -178,7 +185,14 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
178
 
179
  image_submit.click(
180
  analyze_environmental_impact,
181
- inputs=[api_key, gr.Textbox(value="Image Analysis", visible=False), image_input, None, None, None],
 
 
 
 
 
 
 
182
  outputs=image_output
183
  )
184
 
@@ -189,7 +203,14 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
189
 
190
  location_submit.click(
191
  analyze_environmental_impact,
192
- inputs=[api_key, gr.Textbox(value="Geographical Assessment", visible=False), None, None, location_input, None],
 
 
 
 
 
 
 
193
  outputs=location_output
194
  )
195
 
@@ -204,7 +225,14 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
204
 
205
  product_submit.click(
206
  analyze_environmental_impact,
207
- inputs=[api_key, gr.Textbox(value="Product Assessment", visible=False), None, None, None, product_info],
 
 
 
 
 
 
 
208
  outputs=product_output
209
  )
210
 
@@ -219,7 +247,14 @@ with gr.Blocks(title="Smart Environmental Impact Analyzer") as app:
219
 
220
  custom_submit.click(
221
  analyze_environmental_impact,
222
- inputs=[api_key, gr.Textbox(value="Custom Query", visible=False), None, custom_input, None, None],
 
 
 
 
 
 
 
223
  outputs=custom_output
224
  )
225
 
 
170
 
171
  api_key = gr.Textbox(label="OpenRouter API Key", placeholder="Enter your OpenRouter API key", type="password")
172
 
173
+ # Create hidden inputs for each tab
174
+ with gr.Group(visible=False) as hidden_inputs:
175
+ analysis_type_input = gr.Textbox(value="Image Analysis", visible=False)
176
+ empty_text_input = gr.Textbox(value="", visible=False)
177
+ empty_location_input = gr.Textbox(value="", visible=False)
178
+ empty_product_input = gr.Textbox(value="", visible=False)
179
+
180
  with gr.Tabs():
181
  with gr.TabItem("Image Analysis"):
182
  image_input = gr.Image(type="pil", label="Upload an image for environmental analysis")
 
185
 
186
  image_submit.click(
187
  analyze_environmental_impact,
188
+ inputs=[
189
+ api_key,
190
+ gr.Textbox(value="Image Analysis", visible=False),
191
+ image_input,
192
+ empty_text_input,
193
+ empty_location_input,
194
+ empty_product_input
195
+ ],
196
  outputs=image_output
197
  )
198
 
 
203
 
204
  location_submit.click(
205
  analyze_environmental_impact,
206
+ inputs=[
207
+ api_key,
208
+ gr.Textbox(value="Geographical Assessment", visible=False),
209
+ gr.Image(visible=False, type="pil"),
210
+ empty_text_input,
211
+ location_input,
212
+ empty_product_input
213
+ ],
214
  outputs=location_output
215
  )
216
 
 
225
 
226
  product_submit.click(
227
  analyze_environmental_impact,
228
+ inputs=[
229
+ api_key,
230
+ gr.Textbox(value="Product Assessment", visible=False),
231
+ gr.Image(visible=False, type="pil"),
232
+ empty_text_input,
233
+ empty_location_input,
234
+ product_info
235
+ ],
236
  outputs=product_output
237
  )
238
 
 
247
 
248
  custom_submit.click(
249
  analyze_environmental_impact,
250
+ inputs=[
251
+ api_key,
252
+ gr.Textbox(value="Custom Query", visible=False),
253
+ gr.Image(visible=False, type="pil"),
254
+ custom_input,
255
+ empty_location_input,
256
+ empty_product_input
257
+ ],
258
  outputs=custom_output
259
  )
260