patrickvonplaten commited on
Commit
a750c0e
1 Parent(s): c4e3a54
Files changed (2) hide show
  1. __pycache__/app.cpython-310.pyc +0 -0
  2. app.py +5 -6
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
app.py CHANGED
@@ -17,16 +17,15 @@ def read_content(file_path: str) -> str:
17
  return content
18
 
19
  def predict(dict, prompt="", guidance_scale=7.5, steps=20, strength=1.0, scheduler="EulerDiscreteScheduler"):
20
-
21
- scheduler_class_name = scheduler.split("")[0]
22
- scheduler = getattr(diffusers, scheduler_class_name)
23
 
24
  add_kwargs = {}
25
- if len(scheduler.split("")) > 1:
26
  add_kwargs["use_karras"] = True
27
- if len(scheduler.split("")) > 2:
28
  add_kwargs["algorithm_type"] = "sde-dpmsolver++"
29
 
 
30
  pipe.scheduler = scheduler.from_config(pipe.scheduler.config, **add_kwargs)
31
 
32
  init_image = dict["image"].convert("RGB").resize((1024, 1024))
@@ -91,7 +90,7 @@ with image_blocks as demo:
91
  guidance_scale = gr.Number(value=7.5, minimum=1.0, maximum=20.0, step=0.1, label="guidance_scale")
92
  steps = gr.Number(value=20, minimum=10, maximum=50, step=0.1, label="steps")
93
  strength = gr.Number(value=1.0, minimum=0.0, maximum=1.0, step=0.05, label="strength")
94
- schedulers = ["DEISMultistepScheduler", "HeunDiscreteScheduler", "EulerDiscreteScheduler", "DPMSolverMultistepScheduler", "DPMSolverMultistepScheduler Karras", "DPMSolverMultistepScheduler Karras SDE"]
95
  scheduler = gr.Dropdown(choices=schedulers, value="EulerDiscreteScheduler")
96
 
97
  btn = gr.Button("Inpaint!").style(
 
17
  return content
18
 
19
  def predict(dict, prompt="", guidance_scale=7.5, steps=20, strength=1.0, scheduler="EulerDiscreteScheduler"):
20
+ scheduler_class_name = scheduler.split("-")[0]
 
 
21
 
22
  add_kwargs = {}
23
+ if len(scheduler.split("-")) > 1:
24
  add_kwargs["use_karras"] = True
25
+ if len(scheduler.split("-")) > 2:
26
  add_kwargs["algorithm_type"] = "sde-dpmsolver++"
27
 
28
+ scheduler = getattr(diffusers, scheduler_class_name)
29
  pipe.scheduler = scheduler.from_config(pipe.scheduler.config, **add_kwargs)
30
 
31
  init_image = dict["image"].convert("RGB").resize((1024, 1024))
 
90
  guidance_scale = gr.Number(value=7.5, minimum=1.0, maximum=20.0, step=0.1, label="guidance_scale")
91
  steps = gr.Number(value=20, minimum=10, maximum=50, step=0.1, label="steps")
92
  strength = gr.Number(value=1.0, minimum=0.0, maximum=1.0, step=0.05, label="strength")
93
+ schedulers = ["DEISMultistepScheduler", "HeunDiscreteScheduler", "EulerDiscreteScheduler", "DPMSolverMultistepScheduler", "DPMSolverMultistepScheduler-Karras", "DPMSolverMultistepScheduler-Karras-SDE"]
94
  scheduler = gr.Dropdown(choices=schedulers, value="EulerDiscreteScheduler")
95
 
96
  btn = gr.Button("Inpaint!").style(