Uthar commited on
Commit
e9c73e4
·
verified ·
1 Parent(s): 671b6e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -117,7 +117,25 @@ js="""
117
  <script>console.log("BOOOOOOOOOOOOOOOOBS");</script>
118
  """
119
 
120
- with gr.Blocks(fill_width=True, head=js) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  with gr.Tab(str(num_models) + ' Models'):
122
  with gr.Column(scale=2):
123
  with gr.Group():
@@ -134,7 +152,11 @@ with gr.Blocks(fill_width=True, head=js) as demo:
134
  seed_rand = gr.Button("Randomize Seed 🎲", size="sm", variant="secondary")
135
  seed_rand.click(randomize_seed, None, [seed], queue=False)
136
  with gr.Row():
137
- gen_button = gr.Button(f'Generate up to {int(num_models)} images', variant='primary', scale=3)
 
 
 
 
138
  random_button = gr.Button(f'Randomize Models', variant='secondary', scale=1)
139
 
140
  with gr.Column(scale=1):
 
117
  <script>console.log("BOOOOOOOOOOOOOOOOBS");</script>
118
  """
119
 
120
+ css="""
121
+ .Running {
122
+ background-color: green;
123
+ color: white;
124
+ }
125
+ .off {
126
+ background-color: red;
127
+ color: white;
128
+ }
129
+ """
130
+
131
+ def toggle_button(butState):
132
+ if butState == "Running":
133
+ return "Off", gr.Button(variant="secondary", value="Off", elem_classes=["off"])
134
+ else:
135
+ return "Running", gr.Button(variant="primary", value="Running", elem_classes=["Running"])
136
+
137
+
138
+ with gr.Blocks(fill_width=True, head=js, css=css) as demo:
139
  with gr.Tab(str(num_models) + ' Models'):
140
  with gr.Column(scale=2):
141
  with gr.Group():
 
152
  seed_rand = gr.Button("Randomize Seed 🎲", size="sm", variant="secondary")
153
  seed_rand.click(randomize_seed, None, [seed], queue=False)
154
  with gr.Row():
155
+ # gen_button = gr.Button(f'Generate up to {int(num_models)} images', variant='primary', scale=3)
156
+ butState = gr.State(value="Off")
157
+ gen_button = gr.Button(value="Off", variant="secondary", elem_classes=["off"], scale=3)
158
+ gen_button.click(fn=toggle_button, inputs=butState, outputs=[butState, button])
159
+
160
  random_button = gr.Button(f'Randomize Models', variant='secondary', scale=1)
161
 
162
  with gr.Column(scale=1):