multimodalart HF staff commited on
Commit
c24dac7
1 Parent(s): ac586a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -51,6 +51,7 @@ def count_files(*inputs):
51
  Training_Steps = file_counter*200
52
  return(gr.update(visible=True, value=f"You are going to train {file_counter} files for {Training_Steps} steps. This should take around {round(Training_Steps/1.5, 2)} seconds, or {round((Training_Steps/1.5)/3600, 2)}. The T4 GPU costs US$0.60 for 1h, so the estimated costs for this training run should be {round(((Training_Steps/1.5)/3600)*0.6, 2)}"))
53
  def train(*inputs):
 
54
  if os.path.exists("diffusers_model.zip"): os.remove("diffusers_model.zip")
55
  if os.path.exists("model.ckpt"): os.remove("model.ckpt")
56
  file_counter = 0
@@ -263,11 +264,10 @@ with gr.Blocks(css=css) as demo:
263
  steps = gr.Number(label="How many steps", value=800)
264
  perc_txt_encoder = gr.Number(label="Percentage of the training steps the text-encoder should be trained as well", value=30)
265
 
266
- for file in file_collection:
267
- file.change(fn=count_files, inputs=file_collection+[type_of_thing]+[steps]+[perc_txt_encoder]+[swap_auto_calculated], outputs=[training_summary, training_summary])
268
-
269
  type_of_thing.change(fn=swap_text, inputs=[type_of_thing], outputs=[thing_description, thing_image_example, things_naming, perc_txt_encoder], queue=False)
270
  training_summary = gr.Textbox("", visible=False, label="Training Summary")
 
 
271
  train_btn = gr.Button("Start Training")
272
  with gr.Box(visible=False) as try_your_model:
273
  gr.Markdown("Try your model")
 
51
  Training_Steps = file_counter*200
52
  return(gr.update(visible=True, value=f"You are going to train {file_counter} files for {Training_Steps} steps. This should take around {round(Training_Steps/1.5, 2)} seconds, or {round((Training_Steps/1.5)/3600, 2)}. The T4 GPU costs US$0.60 for 1h, so the estimated costs for this training run should be {round(((Training_Steps/1.5)/3600)*0.6, 2)}"))
53
  def train(*inputs):
54
+
55
  if os.path.exists("diffusers_model.zip"): os.remove("diffusers_model.zip")
56
  if os.path.exists("model.ckpt"): os.remove("model.ckpt")
57
  file_counter = 0
 
264
  steps = gr.Number(label="How many steps", value=800)
265
  perc_txt_encoder = gr.Number(label="Percentage of the training steps the text-encoder should be trained as well", value=30)
266
 
 
 
 
267
  type_of_thing.change(fn=swap_text, inputs=[type_of_thing], outputs=[thing_description, thing_image_example, things_naming, perc_txt_encoder], queue=False)
268
  training_summary = gr.Textbox("", visible=False, label="Training Summary")
269
+ for file in file_collection:
270
+ file.change(fn=count_files, inputs=file_collection+[type_of_thing]+[steps]+[perc_txt_encoder]+[swap_auto_calculated], outputs=[training_summary, training_summary])
271
  train_btn = gr.Button("Start Training")
272
  with gr.Box(visible=False) as try_your_model:
273
  gr.Markdown("Try your model")