sxela commited on
Commit
5e29a19
Β·
1 Parent(s): 810fb9a
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -83,6 +83,7 @@ def range_loss(input):
83
  def inference(text, init_image, skip_timesteps, clip_guidance_scale, tv_scale, range_scale, init_scale, seed, image_prompts,timestep_respacing, cutn, im_prompt_weight):
84
  # Model settings
85
  skip_timesteps = min(skip_timesteps, timestep_respacing-1)
 
86
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
87
  model_config = model_and_diffusion_defaults()
88
  model_config.update({
@@ -247,8 +248,8 @@ with demo:
247
  # with gr.Group():
248
  with gr.Column():
249
  init_image = gr.Image(source="upload", label='initial image (optional)')
250
- init_scale = gr.Slider(minimum=0, maximum=10000, step=100, value=1000, label="Look like the image above")
251
- skip_timesteps = gr.Slider(minimum=0, maximum=100, step=1, value=30, label="Style strength")
252
  # with gr.Group():
253
  with gr.Column():
254
  image_prompts = gr.Image(source="upload", label='image prompt (optional)')
 
83
  def inference(text, init_image, skip_timesteps, clip_guidance_scale, tv_scale, range_scale, init_scale, seed, image_prompts,timestep_respacing, cutn, im_prompt_weight):
84
  # Model settings
85
  skip_timesteps = min(skip_timesteps, timestep_respacing-1)
86
+ skip_timesteps = int(timestep_respacing-1 - (timestep_respacing-1)*skip_timesteps/100)
87
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
88
  model_config = model_and_diffusion_defaults()
89
  model_config.update({
 
248
  # with gr.Group():
249
  with gr.Column():
250
  init_image = gr.Image(source="upload", label='initial image (optional)')
251
+ init_scale = gr.Slider(minimum=0, maximum=1000, step=10, value=0, label="Look like the image above")
252
+ skip_timesteps = gr.Slider(minimum=0, maximum=100, step=1, value=30, label="Style strength, % (0 = initial image)")
253
  # with gr.Group():
254
  with gr.Column():
255
  image_prompts = gr.Image(source="upload", label='image prompt (optional)')