Rammohan0504 commited on
Commit
e70dea1
·
verified ·
1 Parent(s): 1f6fe47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -73,20 +73,23 @@ def main():
73
  gr.Markdown("## Are you a new or existing customer?")
74
  is_new_customer = gr.Radio(["New Customer", "Existing Customer"], label="Select Customer Type")
75
  phone_input = gr.Textbox(label="Phone Number", placeholder="Enter your phone number")
76
- name_input = gr.Textbox(label="Name (For New Customers)", placeholder="Enter your name")
77
- email_input = gr.Textbox(label="Email (For New Customers)", placeholder="Enter your email")
 
78
  password_input = gr.Textbox(label="Password", placeholder="Enter your password", type="password")
79
 
80
  action_button = gr.Button("Submit")
81
  result_output = gr.Text(label="Status")
82
 
83
- def handle_input(customer_type, phone, name, email, password):
84
  is_new = customer_type == "New Customer"
 
 
85
  return login_or_signup(is_new, phone, name, email, password)
86
 
87
  action_button.click(
88
  handle_input,
89
- inputs=[is_new_customer, phone_input, name_input, email_input, password_input],
90
  outputs=result_output
91
  )
92
 
 
73
  gr.Markdown("## Are you a new or existing customer?")
74
  is_new_customer = gr.Radio(["New Customer", "Existing Customer"], label="Select Customer Type")
75
  phone_input = gr.Textbox(label="Phone Number", placeholder="Enter your phone number")
76
+ name_input = gr.Textbox(label="Name", placeholder="Enter your name (For New Customers)")
77
+ email_input = gr.Textbox(label="Email", placeholder="Enter your email (For New Customers)")
78
+ username_input = gr.Textbox(label="Username", placeholder="Enter your username (Existing Customers)")
79
  password_input = gr.Textbox(label="Password", placeholder="Enter your password", type="password")
80
 
81
  action_button = gr.Button("Submit")
82
  result_output = gr.Text(label="Status")
83
 
84
+ def handle_input(customer_type, phone, name, email, username, password):
85
  is_new = customer_type == "New Customer"
86
+ if not is_new:
87
+ name, email = None, None # Ignore name and email for existing customers
88
  return login_or_signup(is_new, phone, name, email, password)
89
 
90
  action_button.click(
91
  handle_input,
92
+ inputs=[is_new_customer, phone_input, name_input, email_input, username_input, password_input],
93
  outputs=result_output
94
  )
95