Spaces:
Runtime error
Runtime error
Commit
•
cb024a4
1
Parent(s):
126bc9f
Update app.py
Browse files
app.py
CHANGED
@@ -160,11 +160,11 @@ def train(*inputs):
|
|
160 |
)
|
161 |
run_training(args_general)
|
162 |
torch.cuda.empty_cache()
|
163 |
-
convert("output_model", "model.ckpt")
|
164 |
shutil.rmtree('instance_images')
|
165 |
shutil.make_archive("diffusers_model", 'zip', "output_model")
|
166 |
torch.cuda.empty_cache()
|
167 |
-
return [gr.update(visible=True, value=["diffusers_model.zip"
|
168 |
|
169 |
def generate(prompt):
|
170 |
from diffusers import StableDiffusionPipeline
|
@@ -177,6 +177,10 @@ def generate(prompt):
|
|
177 |
def push(path):
|
178 |
pass
|
179 |
|
|
|
|
|
|
|
|
|
180 |
with gr.Blocks(css=css) as demo:
|
181 |
with gr.Box():
|
182 |
if "IS_SHARED_UI" in os.environ:
|
@@ -264,8 +268,11 @@ with gr.Blocks(css=css) as demo:
|
|
264 |
gr.Markdown("Push to Hugging Face Hub")
|
265 |
model_repo_tag = gr.Textbox(label="Model name or URL", placeholder="username/model_name")
|
266 |
push_button = gr.Button("Push to the Hub")
|
267 |
-
result = gr.File(label="Download the uploaded models (zip file are diffusers weights
|
|
|
|
|
268 |
train_btn.click(fn=train, inputs=is_visible+concept_collection+file_collection+[type_of_thing]+[steps]+[perc_txt_encoder]+[swap_auto_calculated], outputs=[result, try_your_model, push_to_hub])
|
269 |
generate_button.click(fn=generate, inputs=prompt, outputs=result)
|
270 |
push_button.click(fn=push, inputs=model_repo_tag, outputs=[])
|
|
|
271 |
demo.launch()
|
|
|
160 |
)
|
161 |
run_training(args_general)
|
162 |
torch.cuda.empty_cache()
|
163 |
+
#convert("output_model", "model.ckpt")
|
164 |
shutil.rmtree('instance_images')
|
165 |
shutil.make_archive("diffusers_model", 'zip', "output_model")
|
166 |
torch.cuda.empty_cache()
|
167 |
+
return [gr.update(visible=True, value=["diffusers_model.zip"]), gr.update(visible=True), gr.update(visible=True)]
|
168 |
|
169 |
def generate(prompt):
|
170 |
from diffusers import StableDiffusionPipeline
|
|
|
177 |
def push(path):
|
178 |
pass
|
179 |
|
180 |
+
def convert():
|
181 |
+
convert("output_model", "model.ckpt")
|
182 |
+
return gr.update(visible=True, value=["diffusers_model.zip", "model.ckpt"])
|
183 |
+
|
184 |
with gr.Blocks(css=css) as demo:
|
185 |
with gr.Box():
|
186 |
if "IS_SHARED_UI" in os.environ:
|
|
|
268 |
gr.Markdown("Push to Hugging Face Hub")
|
269 |
model_repo_tag = gr.Textbox(label="Model name or URL", placeholder="username/model_name")
|
270 |
push_button = gr.Button("Push to the Hub")
|
271 |
+
result = gr.File(label="Download the uploaded models in the diffusers format (zip file are diffusers weights are CompVis/AUTOMATIC1111 weights)", visible=True)
|
272 |
+
convert_button = gr.Button("Convert to CKPT")
|
273 |
+
|
274 |
train_btn.click(fn=train, inputs=is_visible+concept_collection+file_collection+[type_of_thing]+[steps]+[perc_txt_encoder]+[swap_auto_calculated], outputs=[result, try_your_model, push_to_hub])
|
275 |
generate_button.click(fn=generate, inputs=prompt, outputs=result)
|
276 |
push_button.click(fn=push, inputs=model_repo_tag, outputs=[])
|
277 |
+
convert_button.click(fn=convert, inputs=[], outputs=result)
|
278 |
demo.launch()
|