HelloAI1 commited on
Commit
99797c1
·
verified ·
1 Parent(s): 614fcda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -155,10 +155,7 @@ body {
155
  # --- Gradio Interface ---
156
 
157
  # Define demo OUTSIDE the blocks
158
- demo = gr.Blocks(css=css)
159
-
160
- def start_generation():
161
- return demo
162
 
163
  # Initial Welcome Screen
164
  with gr.Blocks() as welcome_screen:
@@ -176,9 +173,6 @@ with gr.Blocks() as welcome_screen:
176
  with gr.Row():
177
  start_button = gr.Button("Get Started", variant='primary', elem_id="start-button")
178
 
179
- # Connect Welcome Screen to Generation Screen
180
- start_button.click(fn=start_generation, outputs=welcome_screen) # Output welcome_screen
181
-
182
  # Main Generation Screen (Now use the defined 'demo')
183
  with demo:
184
  with gr.Row():
@@ -232,5 +226,16 @@ with demo:
232
 
233
  text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
234
 
 
 
 
 
 
 
 
 
 
 
 
235
  # Launch the Gradio app
236
- welcome_screen.launch(max_threads=128)
 
155
  # --- Gradio Interface ---
156
 
157
  # Define demo OUTSIDE the blocks
158
+ demo = gr.Blocks(css=css)
 
 
 
159
 
160
  # Initial Welcome Screen
161
  with gr.Blocks() as welcome_screen:
 
173
  with gr.Row():
174
  start_button = gr.Button("Get Started", variant='primary', elem_id="start-button")
175
 
 
 
 
176
  # Main Generation Screen (Now use the defined 'demo')
177
  with demo:
178
  with gr.Row():
 
226
 
227
  text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
228
 
229
+ # Tabs to switch between screens
230
+ tabs = gr.Tabs()
231
+ with tabs:
232
+ with gr.TabItem("Welcome Screen"):
233
+ welcome_screen
234
+ with gr.TabItem("Main Generation Screen"):
235
+ demo
236
+
237
+ # Connect Welcome Screen to Generation Screen
238
+ start_button.click(fn=lambda: tabs.set_selected("Main Generation Screen"))
239
+
240
  # Launch the Gradio app
241
+ tabs.launch(max_threads=128)