ljrmary commited on
Commit
4edbe8b
1 Parent(s): 15478ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -32
app.py CHANGED
@@ -1,44 +1,22 @@
1
  import gradio as gr
2
 
3
- def process_input_with_units(address, num_units):
4
- output_text = f"You entered the address: {address}. Number of Units/Spaces: {num_units}."
5
- return output_text
6
-
7
- def process_input_with_area(address, area_gsf):
8
- output_text = f"You entered the address: {address}. Area (in 1000 GSF): {area_gsf}."
9
- return output_text
10
-
11
- iface_units = gr.Interface(
12
- fn=process_input_with_units,
13
- inputs=[
14
- gr.inputs.Textbox(label="Enter your address"),
15
- gr.inputs.Number(label="Number of Units/Spaces", default=1) # Default value is 1
16
- ],
17
- outputs=gr.outputs.Textbox(label="Output"),
18
- )
19
-
20
- iface_area = gr.Interface(
21
- fn=process_input_with_area,
22
- inputs=[
23
- gr.inputs.Textbox(label="Enter your address"),
24
- gr.inputs.Number(label="Area (in 1000 GSF)", default=1) # Default value is 1
25
- ],
26
- outputs=gr.outputs.Textbox(label="Output"),
27
- )
28
-
29
- def launch_interface(selected_option):
30
  if selected_option in ["Off-Street Parking Facility", "Residential"]:
31
- iface_units.launch()
32
  else:
33
- iface_area.launch()
 
34
 
35
  iface = gr.Interface(
36
- fn=launch_interface,
37
  inputs=[
 
38
  gr.inputs.Radio(["Residential", "Office", "Regional Retail", "Local Retail", "Sit Down/High Turnover Restaurant", "Fast Food/without Drive Through",
39
- "Community Facility", "Off-Street Parking Facility"], label="Select an option")
 
40
  ],
41
- outputs=None
42
  )
43
 
44
  iface.launch()
 
 
1
  import gradio as gr
2
 
3
+ def process_input(address, selected_option, additional_input):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  if selected_option in ["Off-Street Parking Facility", "Residential"]:
5
+ output_text = f"You entered the address: {address}. Selected option: {selected_option}. Number of Units/Spaces: {additional_input}."
6
  else:
7
+ output_text = f"You entered the address: {address}. Selected option: {selected_option}. Area (in 1000 GSF): {additional_input}."
8
+ return output_text
9
 
10
  iface = gr.Interface(
11
+ fn=process_input,
12
  inputs=[
13
+ gr.inputs.Textbox(label="Enter your address"),
14
  gr.inputs.Radio(["Residential", "Office", "Regional Retail", "Local Retail", "Sit Down/High Turnover Restaurant", "Fast Food/without Drive Through",
15
+ "Community Facility", "Off-Street Parking Facility"], label="Select an option"),
16
+ gr.inputs.Number(label="Number of Units/Spaces or Area (in 1000 GSF)", default=1) # Default value is 1
17
  ],
18
+ outputs=gr.outputs.Textbox(label="Output"),
19
  )
20
 
21
  iface.launch()
22
+