Spaces:
Runtime error
Runtime error
Commit
Β·
ac4eb90
1
Parent(s):
1ad84b5
bug fixes
Browse files
app.py
CHANGED
|
@@ -78,7 +78,6 @@ def main():
|
|
| 78 |
guidance_scale: float,
|
| 79 |
local_edit_word: str,
|
| 80 |
invert_local_edit: bool,
|
| 81 |
-
negative_prompt: str,
|
| 82 |
self_replace_steps: float,
|
| 83 |
conv_replace_steps: float,
|
| 84 |
cross_replace_steps: float,
|
|
@@ -98,13 +97,14 @@ def main():
|
|
| 98 |
# steps and image size is decided here because edit must be same size as inversion
|
| 99 |
width=width, height=height)
|
| 100 |
|
|
|
|
| 101 |
edited_imgs = editpipeline.run_edit(edit_prompt,
|
| 102 |
guidance_scale=guidance_scale,
|
| 103 |
local_edit_word=local_edit_word,
|
| 104 |
# str OPTIONAL # word describing region of image. i.e. an image of a man in a house.
|
| 105 |
# if you put "man" only the man will be edited, the same word must appear in the inversion prompt as well to work
|
| 106 |
invert_local_edit=invert_local_edit, # if True will edit all areas except region
|
| 107 |
-
neg_prompt=
|
| 108 |
cross_replace_steps=cross_replace_steps, # 0.0 - 0.5 is good
|
| 109 |
self_replace_steps=self_replace_steps, # 0.25-0.65
|
| 110 |
conv_replace_steps=conv_replace_steps, ) # 0.25-0.6, typically like this one lower than self replace)
|
|
@@ -128,6 +128,7 @@ def main():
|
|
| 128 |
with gr.Row():
|
| 129 |
with gr.Column(scale=3):
|
| 130 |
edit_prompt = gr.Textbox(lines=1, label="Edited version of prompt", interactive=True)
|
|
|
|
| 131 |
with gr.Row():
|
| 132 |
with gr.Column(scale=1, min_width=100):
|
| 133 |
generate_button = gr.Button("Generate")
|
|
@@ -147,14 +148,19 @@ def main():
|
|
| 147 |
guidance_scale = gr.Number(value=1.5, label=f"Guidance Scale", interactive=True)
|
| 148 |
|
| 149 |
with gr.Row():
|
| 150 |
-
self_replace_steps = gr.Number(value=50, precision=0, label="
|
| 151 |
-
conv_replace_steps = gr.Number(value=1371, precision=0, label="
|
| 152 |
-
cross_replace_steps = gr.Textbox(lines=1, label="
|
| 153 |
local_edit_word = gr.Textbox(lines=1, label="Local edit word", interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
gr.Markdown(help_text)
|
| 156 |
-
invert_local_edit = True if local_edit_word.value != "" else False
|
| 157 |
-
negative_prompt = "bad quality, low resolution"
|
| 158 |
|
| 159 |
generate_button.click(
|
| 160 |
fn=generate,
|
|
@@ -165,7 +171,6 @@ def main():
|
|
| 165 |
guidance_scale,
|
| 166 |
local_edit_word,
|
| 167 |
invert_local_edit,
|
| 168 |
-
negative_prompt,
|
| 169 |
self_replace_steps,
|
| 170 |
conv_replace_steps,
|
| 171 |
cross_replace_steps,
|
|
|
|
| 78 |
guidance_scale: float,
|
| 79 |
local_edit_word: str,
|
| 80 |
invert_local_edit: bool,
|
|
|
|
| 81 |
self_replace_steps: float,
|
| 82 |
conv_replace_steps: float,
|
| 83 |
cross_replace_steps: float,
|
|
|
|
| 97 |
# steps and image size is decided here because edit must be same size as inversion
|
| 98 |
width=width, height=height)
|
| 99 |
|
| 100 |
+
invert_local_edit = True if invert_local_edit == "Inverted" else False
|
| 101 |
edited_imgs = editpipeline.run_edit(edit_prompt,
|
| 102 |
guidance_scale=guidance_scale,
|
| 103 |
local_edit_word=local_edit_word,
|
| 104 |
# str OPTIONAL # word describing region of image. i.e. an image of a man in a house.
|
| 105 |
# if you put "man" only the man will be edited, the same word must appear in the inversion prompt as well to work
|
| 106 |
invert_local_edit=invert_local_edit, # if True will edit all areas except region
|
| 107 |
+
neg_prompt="bad quality, low resolution",
|
| 108 |
cross_replace_steps=cross_replace_steps, # 0.0 - 0.5 is good
|
| 109 |
self_replace_steps=self_replace_steps, # 0.25-0.65
|
| 110 |
conv_replace_steps=conv_replace_steps, ) # 0.25-0.6, typically like this one lower than self replace)
|
|
|
|
| 128 |
with gr.Row():
|
| 129 |
with gr.Column(scale=3):
|
| 130 |
edit_prompt = gr.Textbox(lines=1, label="Edited version of prompt", interactive=True)
|
| 131 |
+
|
| 132 |
with gr.Row():
|
| 133 |
with gr.Column(scale=1, min_width=100):
|
| 134 |
generate_button = gr.Button("Generate")
|
|
|
|
| 148 |
guidance_scale = gr.Number(value=1.5, label=f"Guidance Scale", interactive=True)
|
| 149 |
|
| 150 |
with gr.Row():
|
| 151 |
+
self_replace_steps = gr.Number(value=50, precision=0, label="Self attn replace steps", interactive=True)
|
| 152 |
+
conv_replace_steps = gr.Number(value=1371, precision=0, label="Conv replace steps", interactive=True)
|
| 153 |
+
cross_replace_steps = gr.Textbox(lines=1, label="Cross attn replace steps", interactive=True)
|
| 154 |
local_edit_word = gr.Textbox(lines=1, label="Local edit word", interactive=True)
|
| 155 |
+
invert_local_edit = gr.Radio(
|
| 156 |
+
["Normal", "Inverted"],
|
| 157 |
+
value="Normal",
|
| 158 |
+
type="index",
|
| 159 |
+
show_label=False,
|
| 160 |
+
interactive=True,
|
| 161 |
+
)
|
| 162 |
|
| 163 |
gr.Markdown(help_text)
|
|
|
|
|
|
|
| 164 |
|
| 165 |
generate_button.click(
|
| 166 |
fn=generate,
|
|
|
|
| 171 |
guidance_scale,
|
| 172 |
local_edit_word,
|
| 173 |
invert_local_edit,
|
|
|
|
| 174 |
self_replace_steps,
|
| 175 |
conv_replace_steps,
|
| 176 |
cross_replace_steps,
|