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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -83,15 +83,8 @@ 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=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"
90
- elif sleep_time == 900:
91
- sleep_time_value = "15 minutes"
92
- elif sleep_time == 1800:
93
- sleep_time_value = "30 minutes"
94
- elif sleep_time == 3600:
95
  sleep_time_value = "1 hour"
96
  elif sleep_time == 36000:
97
  sleep_time_value = "10 hours"
@@ -103,6 +96,15 @@ 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=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):
@@ -264,7 +266,7 @@ div#warning-setgpu p.actions > a {
264
  }
265
  div#warning-setsleeptime {
266
  background-color: #fff4eb;
267
- padding: 0 10px 5px;
268
  margin: 20px 0;
269
  }
270
  """
@@ -325,11 +327,9 @@ with gr.Blocks(css=css) as demo:
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)
 
83
  sleep_time = get_sleep_time()
84
  if sleep_time is None :
85
  sleep_time_value = "Don't sleep"
86
+ elif sleep_time >= 36000:
87
+ if sleep_time == 3600:
 
 
 
 
 
 
 
88
  sleep_time_value = "1 hour"
89
  elif sleep_time == 36000:
90
  sleep_time_value = "10 hours"
 
96
  sleep_time_value = "72 hours"
97
  elif sleep_time == 604800:
98
  sleep_time_value = "1 week"
99
+ 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)
100
+ else :
101
+ if sleep_time == 300:
102
+ sleep_time_value = "5 minutes"
103
+ elif sleep_time == 900:
104
+ sleep_time_value = "15 minutes"
105
+ elif sleep_time == 1800:
106
+ sleep_time_value = "30 minutes"
107
+
108
  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)
109
 
110
  def train_dreambooth_blora_sdxl(instance_data_dir, b_lora_trained_folder, instance_prompt, class_prompt, max_train_steps, checkpoint_steps):
 
266
  }
267
  div#warning-setsleeptime {
268
  background-color: #fff4eb;
269
+ padding: 10px 5px;
270
  margin: 20px 0;
271
  }
272
  """
 
327
  )
328
  sleep_time_message = gr.HTML('''
329
  <div class="gr-prose">
330
+ <p>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. </p>
331
+ <p>Set it to <strong>"Don't sleep"</strong> or <strong>more than 1 hour</strong> to be safe.</p>
332
+ <p>Don't worry, after training is finished, sleep time will be back to 5 minutes.</p>
 
 
333
  </div>
334
  ''', elem_id="warning-setsleeptime")
335
  training_type = gr.Radio(label="Training type", choices=["style", "concept"], value="style", visible=False)