Commit
·
9255bd7
1
Parent(s):
d1c3953
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,6 +68,7 @@ def train(*inputs):
|
|
| 68 |
image.save(f'instance_images/{prompt}_({j+1}).jpg', format="JPEG", quality = 100)
|
| 69 |
file_counter += 1
|
| 70 |
|
|
|
|
| 71 |
uses_custom = inputs[-1]
|
| 72 |
type_of_thing = inputs[-4]
|
| 73 |
if(uses_custom):
|
|
@@ -240,6 +241,16 @@ with gr.Blocks(css=css) as demo:
|
|
| 240 |
|
| 241 |
type_of_thing.change(fn=swap_text, inputs=[type_of_thing], outputs=[thing_description, thing_image_example, things_naming, perc_txt_encoder])
|
| 242 |
train_btn = gr.Button("Start Training")
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
demo.launch()
|
|
|
|
| 68 |
image.save(f'instance_images/{prompt}_({j+1}).jpg', format="JPEG", quality = 100)
|
| 69 |
file_counter += 1
|
| 70 |
|
| 71 |
+
os.makedirs('output_model',exist_ok=True)
|
| 72 |
uses_custom = inputs[-1]
|
| 73 |
type_of_thing = inputs[-4]
|
| 74 |
if(uses_custom):
|
|
|
|
| 241 |
|
| 242 |
type_of_thing.change(fn=swap_text, inputs=[type_of_thing], outputs=[thing_description, thing_image_example, things_naming, perc_txt_encoder])
|
| 243 |
train_btn = gr.Button("Start Training")
|
| 244 |
+
with gr.Box(visible=False) as try_your_model:
|
| 245 |
+
gr.Markdown("Try your model")
|
| 246 |
+
with gr.Row():
|
| 247 |
+
prompt = gr.Textbox(label="Type your prompt")
|
| 248 |
+
result = gr.Image()
|
| 249 |
+
generate_button = gr.Button("Generate Image")
|
| 250 |
+
with gr.Box(visible=False) as push_to_hub:
|
| 251 |
+
gr.Markdown("Push to Hugging Face Hub")
|
| 252 |
+
model_repo_tag = gr.Textbox(label="Model name or URL", placeholder="username/model_name")
|
| 253 |
+
push_button = gr.Button("Push to the Hub")
|
| 254 |
+
result = gr.File(label="Download the uploaded models (zip file are diffusers weights, *.ckpt are CompVis/AUTOMATIC1111 weights)", visible=False)
|
| 255 |
+
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])
|
| 256 |
demo.launch()
|