Eduarr commited on
Commit
effc3bd
·
1 Parent(s): e7c07a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -70
app.py CHANGED
@@ -129,73 +129,4 @@ with gr.Blocks(css=css) as demo:
129
  You can now train your model! You will be billed by the minute from when you activated the GPU until when it is turned off.
130
  </p>
131
  </div>
132
- ''', elem_id="warning-ready")
133
- else:
134
- top_description = gr.HTML(f'''
135
- <div class="gr-prose">
136
- <h2><svg xmlns="http://www.w3.org/2000/svg" width="18px" height="18px" style="margin-right: 0px;display: inline-block;"fill="none"><path fill="#fff" d="M7 13.2a6.3 6.3 0 0 0 4.4-10.7A6.3 6.3 0 0 0 .6 6.9 6.3 6.3 0 0 0 7 13.2Z"/><path fill="#fff" fill-rule="evenodd" d="M7 0a6.9 6.9 0 0 1 4.8 11.8A6.9 6.9 0 0 1 0 7 6.9 6.9 0 0 1 7 0Zm0 0v.7V0ZM0 7h.6H0Zm7 6.8v-.6.6ZM13.7 7h-.6.6ZM9.1 1.7c-.7-.3-1.4-.4-2.2-.4a5.6 5.6 0 0 0-4 1.6 5.6 5.6 0 0 0-1.6 4 5.6 5.6 0 0 0 1.6 4 5.6 5.6 0 0 0 4 1.7 5.6 5.6 0 0 0 4-1.7 5.6 5.6 0 0 0 1.7-4 5.6 5.6 0 0 0-1.7-4c-.5-.5-1.1-.9-1.8-1.2Z" clip-rule="evenodd"/><path fill="#000" fill-rule="evenodd" d="M7 2.9a.8.8 0 1 1 0 1.5A.8.8 0 0 1 7 3ZM5.8 5.7c0-.4.3-.6.6-.6h.7c.3 0 .6.2.6.6v3.7h.5a.6.6 0 0 1 0 1.3H6a.6.6 0 0 1 0-1.3h.4v-3a.6.6 0 0 1-.6-.7Z" clip-rule="evenodd"/></svg>
137
- You have successfully duplicated the SD-XL Training Space 🎉</h2>
138
- <p>There's only one step left before you can train your model: <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline" target="_blank">attribute a <b>T4-small or A10G-small GPU</b> to it (via the Settings tab)</a> and run the training below.
139
- You will be billed by the minute from when you activate the GPU until when it is turned off.</p>
140
- <p class="actions">
141
- <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings">🔥 &nbsp; Set recommended GPU</a>
142
- </p>
143
- </div>
144
- ''', elem_id="warning-setgpu")
145
-
146
- gr.Markdown("# SD-XL Dreambooth LoRa Training UI 💭")
147
-
148
- upload_my_images = gr.Checkbox(label="Drop your training images ? (optional)", value=False)
149
- gr.Markdown("Use this step to upload your training images and create a new dataset. If you already have a dataset stored on your HF profile, you can skip this step, and provide your dataset ID in the training `Datased ID` input below.")
150
-
151
- with gr.Group(visible=False, elem_id="upl-dataset-group") as upload_group:
152
- with gr.Row():
153
- images = gr.File(file_types=["image"], label="Upload your images", file_count="multiple", interactive=True, visible=True)
154
- with gr.Column():
155
- new_dataset_name = gr.Textbox(label="Set new dataset name", placeholder="e.g.: my_awesome_dataset")
156
- dataset_status = gr.Textbox(label="dataset status")
157
- load_btn = gr.Button("Load images to new dataset", elem_id="load-dataset-btn")
158
-
159
- gr.Markdown("## Training ")
160
- gr.Markdown("You can use an existing image dataset, find a dataset example here: [https://huggingface.co/datasets/diffusers/dog-example](https://huggingface.co/datasets/diffusers/dog-example) ;)")
161
-
162
- with gr.Row():
163
- dataset_id = gr.Textbox(label="Dataset ID", info="use one of your previously uploaded image datasets on your HF profile", placeholder="diffusers/dog-example")
164
- instance_prompt = gr.Textbox(label="Concept prompt", info="concept prompt - use a unique, made up word to avoid collisions")
165
-
166
- with gr.Row():
167
- model_output_folder = gr.Textbox(label="Output model folder name", placeholder="lora-trained-xl-folder")
168
- max_train_steps = gr.Number(label="Max Training Steps", value=500, precision=0, step=10)
169
- checkpoint_steps = gr.Number(label="Checkpoints Steps", value=100, precision=0, step=10)
170
-
171
- remove_gpu = gr.Checkbox(label="Remove GPU After Training", value=True, info="If NOT enabled, don't forget to remove the GPU attribution after you are done.")
172
- train_button = gr.Button("Train !")
173
-
174
- train_status = gr.Textbox(label="Training status")
175
-
176
- upload_my_images.change(
177
- fn = check_upload_or_no,
178
- inputs =[upload_my_images],
179
- outputs = [upload_group]
180
- )
181
-
182
- load_btn.click(
183
- fn = load_images_to_dataset,
184
- inputs = [images, new_dataset_name],
185
- outputs = [dataset_status, dataset_id]
186
- )
187
-
188
- train_button.click(
189
- fn = main,
190
- inputs = [
191
- dataset_id,
192
- model_output_folder,
193
- instance_prompt,
194
- max_train_steps,
195
- checkpoint_steps,
196
- remove_gpu
197
- ],
198
- outputs = [train_status]
199
- )
200
-
201
-
 
129
  You can now train your model! You will be billed by the minute from when you activated the GPU until when it is turned off.
130
  </p>
131
  </div>
132
+