Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -78,6 +78,7 @@ def generate_image(
|
|
78 |
height=1024,
|
79 |
scale=5,
|
80 |
steps=30,
|
|
|
81 |
seed=-1):
|
82 |
|
83 |
if seed == -1:
|
@@ -98,17 +99,18 @@ def generate_image(
|
|
98 |
|
99 |
if init_image:
|
100 |
image = pipe2(
|
101 |
-
text,
|
102 |
image=init_image,
|
103 |
-
|
104 |
guidance_scale=scale,
|
105 |
num_inference_steps=steps,
|
|
|
106 |
generator = generator,
|
107 |
)
|
108 |
else:
|
109 |
image = pipe(
|
110 |
-
text,
|
111 |
-
|
112 |
width=width,
|
113 |
height=height,
|
114 |
guidance_scale=scale,
|
@@ -137,7 +139,7 @@ examples = [
|
|
137 |
|
138 |
with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
139 |
gr.HTML("<h1><center>SD3M🦄</center></h1>")
|
140 |
-
gr.HTML("<p><center><a href='https://huggingface.co/stabilityai/stable-diffusion-3-medium'>sd3m</a> text/image-to-image generation</center></p>")
|
141 |
with gr.Group():
|
142 |
with gr.Row():
|
143 |
prompt = gr.MultimodalTextbox(label='Enter Your Prompt (Multi-Languages)', interactive=True, placeholder="Enter prompt, add one image.", file_types=['image'], scale=6)
|
@@ -176,6 +178,13 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
176 |
step=1,
|
177 |
value=30,
|
178 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
with gr.Row():
|
180 |
seed = gr.Slider(
|
181 |
label="Seed (-1 Get Random)",
|
@@ -194,11 +203,11 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
194 |
)
|
195 |
|
196 |
prompt.submit(fn=generate_image,
|
197 |
-
inputs=[prompt, negative, width, height, scale, steps, seed],
|
198 |
outputs=img,
|
199 |
)
|
200 |
submit.click(fn=generate_image,
|
201 |
-
inputs=[prompt, negative, width, height, scale, steps, seed],
|
202 |
outputs=img,
|
203 |
)
|
204 |
|
|
|
78 |
height=1024,
|
79 |
scale=5,
|
80 |
steps=30,
|
81 |
+
strength=0.7,
|
82 |
seed=-1):
|
83 |
|
84 |
if seed == -1:
|
|
|
99 |
|
100 |
if init_image:
|
101 |
image = pipe2(
|
102 |
+
prompt_3=text,
|
103 |
image=init_image,
|
104 |
+
negative_prompt_3=negative,
|
105 |
guidance_scale=scale,
|
106 |
num_inference_steps=steps,
|
107 |
+
strength=strength,
|
108 |
generator = generator,
|
109 |
)
|
110 |
else:
|
111 |
image = pipe(
|
112 |
+
prompt_3=text,
|
113 |
+
negative_prompt_3=negative,
|
114 |
width=width,
|
115 |
height=height,
|
116 |
guidance_scale=scale,
|
|
|
139 |
|
140 |
with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
141 |
gr.HTML("<h1><center>SD3M🦄</center></h1>")
|
142 |
+
gr.HTML("<p><center><a href='https://huggingface.co/stabilityai/stable-diffusion-3-medium'>sd3m</a> text/image-to-image generation<br>Update: img2img, T5 long token</center></p>")
|
143 |
with gr.Group():
|
144 |
with gr.Row():
|
145 |
prompt = gr.MultimodalTextbox(label='Enter Your Prompt (Multi-Languages)', interactive=True, placeholder="Enter prompt, add one image.", file_types=['image'], scale=6)
|
|
|
178 |
step=1,
|
179 |
value=30,
|
180 |
)
|
181 |
+
strength = gr.Slider(
|
182 |
+
label="Strength",
|
183 |
+
minimum=0.0,
|
184 |
+
maximum=1.0,
|
185 |
+
step=0.1,
|
186 |
+
value=0.7,
|
187 |
+
)
|
188 |
with gr.Row():
|
189 |
seed = gr.Slider(
|
190 |
label="Seed (-1 Get Random)",
|
|
|
203 |
)
|
204 |
|
205 |
prompt.submit(fn=generate_image,
|
206 |
+
inputs=[prompt, negative, width, height, scale, steps, strength, seed],
|
207 |
outputs=img,
|
208 |
)
|
209 |
submit.click(fn=generate_image,
|
210 |
+
inputs=[prompt, negative, width, height, scale, steps, strength, seed],
|
211 |
outputs=img,
|
212 |
)
|
213 |
|