Spaces:
Runtime error
Runtime error
Commit
·
0e95c6d
1
Parent(s):
7389249
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,11 +9,11 @@ from free_lunch_utils import register_free_upblock2d, register_free_crossattn_up
|
|
| 9 |
torch.manual_seed(42)
|
| 10 |
model_id = "CompVis/stable-diffusion-v1-4"
|
| 11 |
|
| 12 |
-
pip_sd = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 13 |
-
pip_sd = pip_sd.to("cuda")
|
| 14 |
|
| 15 |
-
pip_freeu = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 16 |
-
pip_freeu = pip_freeu.to("cuda")
|
| 17 |
# # -------- freeu block registration
|
| 18 |
# register_free_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
|
| 19 |
# register_free_crossattn_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
|
|
@@ -97,42 +97,39 @@ options = ['SD1.4', 'SD1.5', 'SD2.1']
|
|
| 97 |
with block:
|
| 98 |
gr.Markdown("SD vs. FreeU.")
|
| 99 |
with gr.Row():
|
| 100 |
-
with gr.
|
| 101 |
-
with gr.
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
| 112 |
with gr.Row():
|
| 113 |
-
with gr.Column(min_width=256) as c1:
|
| 114 |
-
image_1 = gr.Image(interactive=False)
|
| 115 |
-
image_1_label = gr.Markdown("SD")
|
| 116 |
-
with gr.Row():
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
with gr.Group():
|
| 121 |
-
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
| 122 |
-
with gr.Column():
|
| 123 |
-
text = gr.Textbox(
|
| 124 |
-
label="Enter your prompt",
|
| 125 |
-
show_label=False,
|
| 126 |
-
max_lines=1,
|
| 127 |
-
placeholder="Enter your prompt",
|
| 128 |
-
container=False,
|
| 129 |
-
)
|
| 130 |
-
btn = gr.Button("Generate image", scale=0)
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
|
| 138 |
# with gr.Column():
|
|
|
|
| 9 |
torch.manual_seed(42)
|
| 10 |
model_id = "CompVis/stable-diffusion-v1-4"
|
| 11 |
|
| 12 |
+
# pip_sd = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 13 |
+
# pip_sd = pip_sd.to("cuda")
|
| 14 |
|
| 15 |
+
# pip_freeu = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 16 |
+
# pip_freeu = pip_freeu.to("cuda")
|
| 17 |
# # -------- freeu block registration
|
| 18 |
# register_free_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
|
| 19 |
# register_free_crossattn_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
|
|
|
|
| 97 |
with block:
|
| 98 |
gr.Markdown("SD vs. FreeU.")
|
| 99 |
with gr.Row():
|
| 100 |
+
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
| 101 |
+
with gr.Column():
|
| 102 |
+
text = gr.Textbox(
|
| 103 |
+
label="Enter your prompt",
|
| 104 |
+
show_label=False,
|
| 105 |
+
max_lines=1,
|
| 106 |
+
placeholder="Enter your prompt",
|
| 107 |
+
container=False,
|
| 108 |
+
)
|
| 109 |
+
btn = gr.Button("Generate image", scale=0)
|
| 110 |
+
|
| 111 |
+
with gr.Row():
|
| 112 |
+
with gr.Column(min_width=256) as c1:
|
| 113 |
+
image_1 = gr.Image(interactive=False)
|
| 114 |
+
image_1_label = gr.Markdown("SD")
|
| 115 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
+
|
| 118 |
+
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
| 119 |
+
with gr.Column():
|
| 120 |
+
text = gr.Textbox(
|
| 121 |
+
label="Enter your prompt",
|
| 122 |
+
show_label=False,
|
| 123 |
+
max_lines=1,
|
| 124 |
+
placeholder="Enter your prompt",
|
| 125 |
+
container=False,
|
| 126 |
+
)
|
| 127 |
+
btn = gr.Button("Generate image", scale=0)
|
| 128 |
+
|
| 129 |
+
with gr.Row():
|
| 130 |
+
with gr.Column(min_width=256) as c2:
|
| 131 |
+
image_2 = gr.Image(interactive=False)
|
| 132 |
+
image_2_label = gr.Markdown("FreeU")
|
| 133 |
|
| 134 |
|
| 135 |
# with gr.Column():
|