Update app.py
Browse files
app.py
CHANGED
@@ -31,12 +31,13 @@ def infer(prompt, init_image):
|
|
31 |
text_embedding_optimization_steps=100,
|
32 |
model_fine_tuning_optimization_steps=500)
|
33 |
|
34 |
-
with torch.no_grad():
|
35 |
-
|
36 |
|
37 |
-
res = pipe(alpha=1)
|
38 |
|
39 |
-
return res.images[0]
|
|
|
40 |
|
41 |
title = """
|
42 |
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
@@ -108,12 +109,13 @@ with gr.Blocks(css=css) as block:
|
|
108 |
prompt_input = gr.Textbox(label="Target text", placeholder="Describe the image with what you want to change about the subject")
|
109 |
image_init = gr.Image(source="upload", type="filepath",label="Input Image")
|
110 |
|
111 |
-
|
112 |
|
113 |
image_output = gr.Image(label="Edited image")
|
|
|
114 |
|
115 |
gr.HTML(article)
|
116 |
|
117 |
-
submit_btn.click(fn=infer, inputs=[prompt_input,image_init], outputs=[
|
118 |
|
119 |
block.queue(max_size=12).launch(show_api=False)
|
|
|
31 |
text_embedding_optimization_steps=100,
|
32 |
model_fine_tuning_optimization_steps=500)
|
33 |
|
34 |
+
#with torch.no_grad():
|
35 |
+
# torch.cuda.empty_cache()
|
36 |
|
37 |
+
#res = pipe(alpha=1)
|
38 |
|
39 |
+
#return res.images[0]
|
40 |
+
return 'trained success'
|
41 |
|
42 |
title = """
|
43 |
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
|
|
109 |
prompt_input = gr.Textbox(label="Target text", placeholder="Describe the image with what you want to change about the subject")
|
110 |
image_init = gr.Image(source="upload", type="filepath",label="Input Image")
|
111 |
|
112 |
+
train_btn = gr.Button("Train")
|
113 |
|
114 |
image_output = gr.Image(label="Edited image")
|
115 |
+
text_output = gr.Image(label="trained status")
|
116 |
|
117 |
gr.HTML(article)
|
118 |
|
119 |
+
submit_btn.click(fn=infer, inputs=[prompt_input,image_init], outputs=[text_output])
|
120 |
|
121 |
block.queue(max_size=12).launch(show_api=False)
|