radames commited on
Commit
a123ffa
1 Parent(s): 8bd5f07
Files changed (2) hide show
  1. app.py +13 -10
  2. utils.py +22 -2
app.py CHANGED
@@ -65,7 +65,7 @@ rmbg_model = BriaRMBG.from_pretrained("briaai/RMBG-1.4").to(device)
65
  def predict(
66
  prompt: str,
67
  negative_prompt: str,
68
- input_image: Image.Image | None,
69
  remove_bg: bool,
70
  cond_mode: str,
71
  seed: int,
@@ -192,19 +192,22 @@ def flatten(l: List[List[any]]) -> List[any]:
192
 
193
 
194
  def predict_examples(
195
- prompt, negative_prompt, input_image=None, remove_bg=False, cond_mode=None
196
  ):
 
 
 
197
  return predict(
198
  prompt,
199
  negative_prompt,
200
  input_image,
201
  remove_bg,
202
  cond_mode,
203
- 0,
204
  "euler",
205
  "normal",
206
- 20,
207
- 8.0,
208
  1.0,
209
  )
210
 
@@ -256,18 +259,18 @@ with gr.Blocks(css=css) as blocks:
256
  sampler_name = gr.Dropdown(
257
  choices=samplers.KSampler.SAMPLERS,
258
  label="Sampler Name",
259
- value="dpmpp_2m_sde",
260
  )
261
  scheduler = gr.Dropdown(
262
  choices=samplers.KSampler.SCHEDULERS,
263
  label="Scheduler",
264
- value="karras",
265
  )
266
  steps = gr.Slider(
267
  label="Steps", value=20, minimum=1, maximum=50, step=1
268
  )
269
  cfg = gr.Number(
270
- label="CFG", value=5.0, minimum=0.0, maximum=100.0, step=0.1
271
  )
272
  denoise = gr.Number(
273
  label="Denoise", value=1.0, minimum=0.0, maximum=1.0, step=0.01
@@ -294,9 +297,9 @@ with gr.Blocks(css=css) as blocks:
294
  gr.Examples(
295
  fn=predict_examples,
296
  examples=examples,
297
- inputs=[prompt, negative_prompt, input_image, remove_bg, cond_mode],
298
  outputs=outputs,
299
- cache_examples=False,
300
  )
301
 
302
  button.click(fn=predict, inputs=inputs, outputs=outputs)
 
65
  def predict(
66
  prompt: str,
67
  negative_prompt: str,
68
+ input_image: Image.Image,
69
  remove_bg: bool,
70
  cond_mode: str,
71
  seed: int,
 
192
 
193
 
194
  def predict_examples(
195
+ prompt, negative_prompt, input_image=None, remove_bg=False, cond_mode=None, seed=-1
196
  ):
197
+ print(
198
+ "RUUNING EXAMPLES", prompt, negative_prompt, input_image, remove_bg, cond_mode
199
+ )
200
  return predict(
201
  prompt,
202
  negative_prompt,
203
  input_image,
204
  remove_bg,
205
  cond_mode,
206
+ seed,
207
  "euler",
208
  "normal",
209
+ 30,
210
+ 10.0,
211
  1.0,
212
  )
213
 
 
259
  sampler_name = gr.Dropdown(
260
  choices=samplers.KSampler.SAMPLERS,
261
  label="Sampler Name",
262
+ value="euler",
263
  )
264
  scheduler = gr.Dropdown(
265
  choices=samplers.KSampler.SCHEDULERS,
266
  label="Scheduler",
267
+ value="normal",
268
  )
269
  steps = gr.Slider(
270
  label="Steps", value=20, minimum=1, maximum=50, step=1
271
  )
272
  cfg = gr.Number(
273
+ label="CFG", value=10.0, minimum=0.0, maximum=100.0, step=0.1
274
  )
275
  denoise = gr.Number(
276
  label="Denoise", value=1.0, minimum=0.0, maximum=1.0, step=0.01
 
297
  gr.Examples(
298
  fn=predict_examples,
299
  examples=examples,
300
+ inputs=[prompt, negative_prompt, input_image, remove_bg, cond_mode, seed],
301
  outputs=outputs,
302
+ cache_examples=True,
303
  )
304
 
305
  button.click(fn=predict, inputs=inputs, outputs=outputs)
utils.py CHANGED
@@ -118,6 +118,7 @@ examples = [
118
  None,
119
  False,
120
  None,
 
121
  ],
122
  [
123
  "A beautiful toucan bird flying in the sky",
@@ -125,19 +126,38 @@ examples = [
125
  "./examples/bg.png",
126
  False,
127
  "SDXL, Background",
 
128
  ],
129
  [
130
- "A men watching a concert",
131
  "ugly distorted image, low quality, text, bad, not good ,watermark",
132
  "./examples/lecun.png",
133
  True,
134
  "SDXL, Foreground",
 
135
  ],
136
  [
137
- "A men watching a concert",
138
  "ugly distorted image, low quality, text, bad, not good ,watermark",
139
  "./examples/julien.png",
140
  True,
141
  "SDXL, Foreground",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  ],
143
  ]
 
118
  None,
119
  False,
120
  None,
121
+ 1231231,
122
  ],
123
  [
124
  "A beautiful toucan bird flying in the sky",
 
126
  "./examples/bg.png",
127
  False,
128
  "SDXL, Background",
129
+ 123123,
130
  ],
131
  [
132
+ "graphic design label of a wine bottle detail, high quality",
133
  "ugly distorted image, low quality, text, bad, not good ,watermark",
134
  "./examples/lecun.png",
135
  True,
136
  "SDXL, Foreground",
137
+ 123123,
138
  ],
139
  [
140
+ "An image of a galaxy",
141
  "ugly distorted image, low quality, text, bad, not good ,watermark",
142
  "./examples/julien.png",
143
  True,
144
  "SDXL, Foreground",
145
+ 123123,
146
+ ],
147
+ [
148
+ "a men jumping on swiming pool full of people",
149
+ "ugly distorted image, low quality, text, bad, not good ,watermark",
150
+ "./examples/old_jump.png",
151
+ False,
152
+ "SDXL, Foreground",
153
+ 123123,
154
+ ],
155
+ [
156
+ "a cute cat flying over Manhattan time square",
157
+ "ugly distorted image, low quality, text, bad, not good ,watermark",
158
+ "./examples/cat.png",
159
+ True,
160
+ "SDXL, Foreground",
161
+ 123123,
162
  ],
163
  ]