Spaces:
vilarin
/
Running on Zero

vilarin commited on
Commit
3fc8ee9
·
verified ·
1 Parent(s): b914b6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -94,7 +94,7 @@ def generate_image(
94
  negative="low quality",
95
  width=1024,
96
  height=1024,
97
- scale=5,
98
  steps=30,
99
  strength=0.7,
100
  seed=-1,
@@ -121,23 +121,26 @@ def generate_image(
121
  prompt=text,
122
  image=init_image,
123
  negative_prompt=negative,
124
- guidance_scale=scale,
125
  num_inference_steps=steps,
126
  strength=strength,
127
  generator = generator,
128
  num_images_per_prompt = nums,
129
- )
130
  else:
131
  image = pipe(
132
  prompt=text,
133
  negative_prompt=negative,
134
  width=width,
135
  height=height,
136
- guidance_scale=scale,
137
  num_inference_steps=steps,
138
  generator = generator,
139
  num_images_per_prompt = nums,
140
  ).images
 
 
 
141
  return image, seed
142
 
143
 
@@ -159,8 +162,8 @@ examples = [
159
  # Gradio Interface
160
 
161
  with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
162
- gr.HTML("<h1><center>SD3M🦄</center></h1>")
163
- gr.HTML("<p><center><a href='https://huggingface.co/stabilityai/stable-diffusion-3-medium'>sd3m</a> text/image-to-image generation<br><b>Update</b>: fix T5 issue to support 512 token</center></p>")
164
  with gr.Group():
165
  with gr.Row():
166
  prompt = gr.MultimodalTextbox(label='Enter Your Prompt (Multi-Languages)', interactive=True, placeholder="Enter prompt, add one image.", file_types=['image'], scale=1)
@@ -184,7 +187,7 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
184
  value=1024,
185
  )
186
  with gr.Row():
187
- scale = gr.Slider(
188
  label="Guidance",
189
  minimum=3.5,
190
  maximum=7,
@@ -212,7 +215,7 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
212
  maximum=10000000000000,
213
  step=1,
214
  value=-1,
215
- scale=3,
216
  )
217
  nums = gr.Slider(
218
  label="Image Numbers",
@@ -233,7 +236,7 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
233
 
234
  prompt.submit(fn=generate_image,
235
  inputs=[prompt, negative, width, height, scale, steps, strength, seed, nums],
236
- outputs=[img,seed],
237
  )
238
 
239
 
 
94
  negative="low quality",
95
  width=1024,
96
  height=1024,
97
+ scales=5,
98
  steps=30,
99
  strength=0.7,
100
  seed=-1,
 
121
  prompt=text,
122
  image=init_image,
123
  negative_prompt=negative,
124
+ guidance_scale=scales,
125
  num_inference_steps=steps,
126
  strength=strength,
127
  generator = generator,
128
  num_images_per_prompt = nums,
129
+ ).images
130
  else:
131
  image = pipe(
132
  prompt=text,
133
  negative_prompt=negative,
134
  width=width,
135
  height=height,
136
+ guidance_scale=scales,
137
  num_inference_steps=steps,
138
  generator = generator,
139
  num_images_per_prompt = nums,
140
  ).images
141
+
142
+ print(image)
143
+ print(seed)
144
  return image, seed
145
 
146
 
 
162
  # Gradio Interface
163
 
164
  with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
165
+ gr.HTML("<h1><center>SD3M🐉</center></h1>")
166
+ gr.HTML("<p><center><a href='https://huggingface.co/stabilityai/stable-diffusion-3-medium'>sd3m🐉</a> text/image-to-image generation<br><b>Update</b>: fix diffuser to support 512 token</center></p>")
167
  with gr.Group():
168
  with gr.Row():
169
  prompt = gr.MultimodalTextbox(label='Enter Your Prompt (Multi-Languages)', interactive=True, placeholder="Enter prompt, add one image.", file_types=['image'], scale=1)
 
187
  value=1024,
188
  )
189
  with gr.Row():
190
+ scales = gr.Slider(
191
  label="Guidance",
192
  minimum=3.5,
193
  maximum=7,
 
215
  maximum=10000000000000,
216
  step=1,
217
  value=-1,
218
+ scale=2,
219
  )
220
  nums = gr.Slider(
221
  label="Image Numbers",
 
236
 
237
  prompt.submit(fn=generate_image,
238
  inputs=[prompt, negative, width, height, scale, steps, strength, seed, nums],
239
+ outputs=[img, seed],
240
  )
241
 
242