Update app.py
Browse files
app.py
CHANGED
|
@@ -33,21 +33,17 @@ def infer(prompt, init_image):
|
|
| 33 |
num_inference_steps=50,
|
| 34 |
generator=generator,
|
| 35 |
text_embedding_optimization_steps=500,
|
| 36 |
-
model_fine_tuning_optimization_steps=
|
| 37 |
|
| 38 |
with torch.no_grad():
|
| 39 |
torch.cuda.empty_cache()
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
res = pipe(alpha=1)
|
| 44 |
-
outputs.append(res.images[0])
|
| 45 |
-
res = pipe(alpha=1.5)
|
| 46 |
-
outputs.append(res.images[0])
|
| 47 |
-
res = pipe(alpha=2)
|
| 48 |
-
outputs.append(res.images[0])
|
| 49 |
|
| 50 |
-
|
|
|
|
| 51 |
#return 'trained success'
|
| 52 |
|
| 53 |
title = """
|
|
@@ -122,11 +118,11 @@ with gr.Blocks(css=css) as block:
|
|
| 122 |
|
| 123 |
submit_btn = gr.Button("Train")
|
| 124 |
|
| 125 |
-
|
| 126 |
#text_output = gr.Image(label="trained status")
|
| 127 |
|
| 128 |
gr.HTML(article)
|
| 129 |
|
| 130 |
-
submit_btn.click(fn=infer, inputs=[prompt_input,image_init], outputs=[
|
| 131 |
|
| 132 |
block.queue(max_size=12).launch(show_api=False)
|
|
|
|
| 33 |
num_inference_steps=50,
|
| 34 |
generator=generator,
|
| 35 |
text_embedding_optimization_steps=500,
|
| 36 |
+
model_fine_tuning_optimization_steps=600)
|
| 37 |
|
| 38 |
with torch.no_grad():
|
| 39 |
torch.cuda.empty_cache()
|
| 40 |
|
| 41 |
+
|
| 42 |
|
| 43 |
res = pipe(alpha=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
|
| 46 |
+
return res.images[0]
|
| 47 |
#return 'trained success'
|
| 48 |
|
| 49 |
title = """
|
|
|
|
| 118 |
|
| 119 |
submit_btn = gr.Button("Train")
|
| 120 |
|
| 121 |
+
image_output = gr.Gallery(label="Edited image")
|
| 122 |
#text_output = gr.Image(label="trained status")
|
| 123 |
|
| 124 |
gr.HTML(article)
|
| 125 |
|
| 126 |
+
submit_btn.click(fn=infer, inputs=[prompt_input,image_init], outputs=[image_output])
|
| 127 |
|
| 128 |
block.queue(max_size=12).launch(show_api=False)
|