Yaswanth56 commited on
Commit
a98a1c4
·
verified ·
1 Parent(s): 0f18b9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -14
app.py CHANGED
@@ -64,9 +64,9 @@ def handle_rewards(customer_id, bill_amount, apply_rewards):
64
  except Exception as e:
65
  return f"Error applying rewards: {e}", 0, 0
66
 
67
- # Define the Gradio interface with automatic page transitions
68
  def create_interface():
69
- with gr.Page() as demo:
70
  # Login page
71
  with gr.Column(visible=True) as login_page:
72
  gr.Markdown("### Login to your account")
@@ -95,18 +95,6 @@ def create_interface():
95
  inputs=[customer_id_output, bill_amount_input, apply_rewards_checkbox],
96
  outputs=[rewards_message, final_bill_output, remaining_points_output])
97
 
98
- # Final summary page (After calculation)
99
- with gr.Column(visible=False) as summary_page:
100
- gr.Markdown("### Bill Summary")
101
- summary_message = gr.Textbox(label="Summary Message")
102
- final_amount_output = gr.Textbox(label="Final Amount")
103
- remaining_points = gr.Textbox(label="Remaining Points")
104
-
105
- # This page will show the message and final bill when handled in rewards calculation
106
- rewards_button.click(handle_rewards,
107
- inputs=[customer_id_output, bill_amount_input, apply_rewards_checkbox],
108
- outputs=[summary_message, final_amount_output, remaining_points])
109
-
110
  return demo
111
 
112
  # Run the Gradio interface
 
64
  except Exception as e:
65
  return f"Error applying rewards: {e}", 0, 0
66
 
67
+ # Define the Gradio interface with page-like transitions using gr.update()
68
  def create_interface():
69
+ with gr.Blocks() as demo:
70
  # Login page
71
  with gr.Column(visible=True) as login_page:
72
  gr.Markdown("### Login to your account")
 
95
  inputs=[customer_id_output, bill_amount_input, apply_rewards_checkbox],
96
  outputs=[rewards_message, final_bill_output, remaining_points_output])
97
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  return demo
99
 
100
  # Run the Gradio interface