rivapereira123 commited on
Commit
6cf56db
Β·
verified Β·
1 Parent(s): 98451b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -15
app.py CHANGED
@@ -127,13 +127,15 @@ def create_optimized_gradio_interface():
127
  user_role = gr.State()
128
 
129
  # === STEP 1: Start Screen (Role Selection) ===
130
- with gr.Row():
131
- gr.Markdown("## πŸ‘€ Select Your Role to Begin")
 
 
 
 
 
 
132
 
133
- with gr.Row():
134
- with gr.Column():
135
- volunteer_btn = gr.Button("πŸ§‘β€πŸ€β€πŸ§‘ I'm a Volunteer", size="lg")
136
- organizer_btn = gr.Button("πŸ“‹ I'm an Event Organizer", size="lg")
137
 
138
  divider = gr.Markdown("---")
139
 
@@ -219,17 +221,39 @@ def create_optimized_gradio_interface():
219
  # === STEP 3: Button logic to reveal main interface ===
220
 
221
  def set_user_role(role):
222
- return role, gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
 
224
- volunteer_btn.click(
225
- lambda: set_user_role("volunteer"),
226
- outputs=[user_role, main_ui, volunteer_btn, organizer_btn, divider]
227
- )
 
 
 
 
 
 
 
228
 
229
- organizer_btn.click(
230
- lambda: set_user_role("organizer"),
231
- outputs=[user_role, main_ui, volunteer_btn, organizer_btn, divider]
232
- )
233
 
234
  return interface
235
 
 
127
  user_role = gr.State()
128
 
129
  # === STEP 1: Start Screen (Role Selection) ===
130
+
131
+ with gr.Group(visible=True) as role_selection_group:
132
+ role_title = gr.Markdown("### πŸ§‘β€βš•οΈ Select Your Role to Begin")
133
+ with gr.Row():
134
+ with gr.Column():
135
+ volunteer_btn = gr.Button("πŸ™‹ I'm a Volunteer", size="lg")
136
+ with gr.Column():
137
+ organizer_btn = gr.Button("πŸ“‹ I'm an Event Organizer", size="lg")
138
 
 
 
 
 
139
 
140
  divider = gr.Markdown("---")
141
 
 
221
  # === STEP 3: Button logic to reveal main interface ===
222
 
223
  def set_user_role(role):
224
+ return (
225
+ role, # set user_role state
226
+ gr.update(visible=True), # show main UI
227
+ gr.update(visible=False), # hide role title
228
+ gr.update(visible=False), # hide volunteer_btn
229
+ gr.update(visible=False), # hide organizer_btn
230
+ gr.update(visible=False), # hide whole group
231
+ )
232
+
233
+ volunteer_btn.click(
234
+ lambda: set_user_role("volunteer"),
235
+ outputs=[
236
+ user_role,
237
+ main_ui,
238
+ role_title,
239
+ volunteer_btn,
240
+ organizer_btn,
241
+ role_selection_group
242
+ ]
243
+ )
244
 
245
+ organizer_btn.click(
246
+ lambda: set_user_role("organizer"),
247
+ outputs=[
248
+ user_role,
249
+ main_ui,
250
+ role_title,
251
+ volunteer_btn,
252
+ organizer_btn,
253
+ role_selection_group
254
+ ]
255
+ )
256
 
 
 
 
 
257
 
258
  return interface
259