Linoy Tsaban commited on
Commit
e200bfb
1 Parent(s): e8414cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -52,9 +52,9 @@ sd_pipe.scheduler = DDIMScheduler.from_config(sd_model_id, subfolder = "schedule
52
  sem_pipe = SemanticStableDiffusionPipeline.from_pretrained(sd_model_id).to(device)
53
 
54
 
55
- def edit(input_image, input_image_prompt, target_prompt, edit_prompt,
56
- guidance_scale=15, skip=36, num_diffusion_steps=100,
57
- negative_guidance = False):
58
  offsets=(0,0,0,0)
59
  x0 = load_512(input_image, *offsets, device)
60
 
@@ -72,8 +72,8 @@ def edit(input_image, input_image_prompt, target_prompt, edit_prompt,
72
  editing_args = dict(
73
  editing_prompt = [edit_prompt],
74
  reverse_editing_direction = [negative_guidance],
75
- edit_warmup_steps=[5],
76
- edit_guidance_scale=[8],
77
  edit_threshold=[.93],
78
  edit_momentum_scale=0.5,
79
  edit_mom_beta=0.6
@@ -90,11 +90,14 @@ inputs = [
90
  gr.Image(label="input image", shape=(512, 512)),
91
  gr.Textbox(label="input prompt"),
92
  gr.Textbox(label="target prompt"),
93
- gr.Textbox(label="SEGA edit prompt"),
 
 
 
94
  gr.Slider(label="guidance scale", minimum=7, maximum=18, value=15),
95
  gr.Slider(label="skip", minimum=0, maximum=40, value=36),
96
  gr.Slider(label="num diffusion steps", minimum=0, maximum=300, value=100),
97
- gr.Checkbox(label="SEGA negative_guidance"),
98
 
99
 
100
  ]
 
52
  sem_pipe = SemanticStableDiffusionPipeline.from_pretrained(sd_model_id).to(device)
53
 
54
 
55
+ def edit(input_image, input_image_prompt='', target_prompt='', edit_prompt='', negative_guidance = False, edit_warmup_steps=5,
56
+ edit_guidance_scale=8, guidance_scale=15, skip=36, num_diffusion_steps=100,
57
+ ):
58
  offsets=(0,0,0,0)
59
  x0 = load_512(input_image, *offsets, device)
60
 
 
72
  editing_args = dict(
73
  editing_prompt = [edit_prompt],
74
  reverse_editing_direction = [negative_guidance],
75
+ edit_warmup_steps=[edit_warmup_steps],
76
+ edit_guidance_scale=[edit_guidance_scale],
77
  edit_threshold=[.93],
78
  edit_momentum_scale=0.5,
79
  edit_mom_beta=0.6
 
90
  gr.Image(label="input image", shape=(512, 512)),
91
  gr.Textbox(label="input prompt"),
92
  gr.Textbox(label="target prompt"),
93
+ gr.Textbox(label="SEGA edit concept"),
94
+ gr.Checkbox(label="SEGA negative_guidance"),
95
+ gr.Slider(label="warmup steps", minimum=7, maximum=18, value=15),
96
+ gr.Slider(label="edit guidance scale", minimum=0, maximum=15, value=3.5),
97
  gr.Slider(label="guidance scale", minimum=7, maximum=18, value=15),
98
  gr.Slider(label="skip", minimum=0, maximum=40, value=36),
99
  gr.Slider(label="num diffusion steps", minimum=0, maximum=300, value=100),
100
+ ,
101
 
102
 
103
  ]