fffiloni commited on
Commit
1e1abd7
·
verified ·
1 Parent(s): 9619bcc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -11
app.py CHANGED
@@ -83,7 +83,7 @@ def check_sleep_time():
83
  sleep_time = get_sleep_time()
84
  if sleep_time is None :
85
  sleep_time_value = "Don't sleep"
86
- return sleep_time_value, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
87
  else :
88
  if sleep_time == 300:
89
  sleep_time_value = "5 minutes"
@@ -103,7 +103,7 @@ def check_sleep_time():
103
  sleep_time_value = "72 hours"
104
  elif sleep_time == 604800:
105
  sleep_time_value = "1 week"
106
- return sleep_time_value, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
107
 
108
  def train_dreambooth_blora_sdxl(instance_data_dir, b_lora_trained_folder, instance_prompt, class_prompt, max_train_steps, checkpoint_steps):
109
 
@@ -262,6 +262,11 @@ div#warning-setgpu p.actions > a {
262
  font-weight: 600;
263
  font-size: 1.2em;
264
  }
 
 
 
 
 
265
  """
266
  with gr.Blocks(css=css) as demo:
267
  with gr.Column(elem_id="col-container"):
@@ -311,14 +316,22 @@ with gr.Blocks(css=css) as demo:
311
 
312
  with gr.Column():
313
 
314
- with gr.Row():
315
- current_sleep_time = gr.Dropdown(
316
- label="current space sleep time",
317
- choices = [
318
- "Don't sleep", "5 minutes", "15 minutes", "30 minutes", "1 hour", "10 hours", "24 hours", "48 hours", "72 hours", "1 week"
319
- ]
320
- )
321
- #check_sleep_time_btn = gr.Button("check", scale=1)
 
 
 
 
 
 
 
 
322
  training_type = gr.Radio(label="Training type", choices=["style", "concept"], value="style", visible=False)
323
  b_lora_name = gr.Textbox(label="Name your B-LoRa model", placeholder="b_lora_trained_folder", visible=False)
324
  with gr.Row():
@@ -342,7 +355,7 @@ with gr.Blocks(css=css) as demo:
342
  demo.load(
343
  fn = check_sleep_time,
344
  inputs = None,
345
- outputs = [current_sleep_time, b_lora_name, instance_prompt, class_prompt, training_type, training_steps, train_btn]
346
  )
347
 
348
  training_type.change(
 
83
  sleep_time = get_sleep_time()
84
  if sleep_time is None :
85
  sleep_time_value = "Don't sleep"
86
+ return sleep_time_value, gr.update(visible=False), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
87
  else :
88
  if sleep_time == 300:
89
  sleep_time_value = "5 minutes"
 
103
  sleep_time_value = "72 hours"
104
  elif sleep_time == 604800:
105
  sleep_time_value = "1 week"
106
+ return sleep_time_value, gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
107
 
108
  def train_dreambooth_blora_sdxl(instance_data_dir, b_lora_trained_folder, instance_prompt, class_prompt, max_train_steps, checkpoint_steps):
109
 
 
262
  font-weight: 600;
263
  font-size: 1.2em;
264
  }
265
+ div#warning-setsleeptime {
266
+ background-color: #fff4eb;
267
+ padding: 0 10px 5px;
268
+ margin: 20px 0;
269
+ }
270
  """
271
  with gr.Blocks(css=css) as demo:
272
  with gr.Column(elem_id="col-container"):
 
316
 
317
  with gr.Column():
318
 
319
+
320
+ current_sleep_time = gr.Dropdown(
321
+ label="current space sleep time",
322
+ choices = [
323
+ "Don't sleep", "5 minutes", "15 minutes", "30 minutes", "1 hour", "10 hours", "24 hours", "48 hours", "72 hours", "1 week"
324
+ ]
325
+ )
326
+ sleep_time_message = gr.HTML('''
327
+ <div class="gr-prose">
328
+ <p>
329
+ First of all, please make sure your space's sleep time value is set on long enough, so it do not fall asleep during training. <br />
330
+ Set it to <strong>"Don't sleep"</strong> or <strong>more than 1 hour</strong> to be safe.
331
+ Don't worry, after training is finished, sleep time will be back to 5 minutes.
332
+ </p>
333
+ </div>
334
+ ''', elem_id="warning-setsleeptime")
335
  training_type = gr.Radio(label="Training type", choices=["style", "concept"], value="style", visible=False)
336
  b_lora_name = gr.Textbox(label="Name your B-LoRa model", placeholder="b_lora_trained_folder", visible=False)
337
  with gr.Row():
 
355
  demo.load(
356
  fn = check_sleep_time,
357
  inputs = None,
358
+ outputs = [current_sleep_time, sleep_time_message, b_lora_name, instance_prompt, class_prompt, training_type, training_steps, train_btn]
359
  )
360
 
361
  training_type.change(