Skip to content

Commit b622819

Browse files
authored
Expose img2img strength parameter in Web UI (#239)
* Expose img2img strength parameter in Web UI * Fix strength label id Co-authored-by: Mikhail Tishin <[email protected]> Co-authored-by: Kevin Gibbons https://github.com/bakkot
1 parent a547c33 commit b622819

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

ldm/dream/server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def do_POST(self):
6565
post_data = json.loads(self.rfile.read(content_length))
6666
prompt = post_data['prompt']
6767
initimg = post_data['initimg']
68+
strength = float(post_data['strength'])
6869
iterations = int(post_data['iterations'])
6970
steps = int(post_data['steps'])
7071
width = int(post_data['width'])
@@ -174,6 +175,7 @@ def image_progress(sample, step):
174175
# Run img2img
175176
self.model.prompt2image(prompt,
176177
init_img = "./img2img-tmp.png",
178+
strength = strength,
177179
iterations = iterations,
178180
cfg_scale = cfgscale,
179181
seed = seed,

static/dream_web/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ <h2 id="header">Stable Diffusion Dream Server</h2>
5959
<option value="832">832</option> <option value="896">896</option>
6060
<option value="960">960</option> <option value="1024">1024</option>
6161
</select>
62-
<br>
63-
<label title="Upload an image to use img2img" for="initimg">Img2Img Init:</label>
64-
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png">
6562
<label title="Set to -1 for random seed" for="seed">Seed:</label>
6663
<input value="-1" type="number" id="seed" name="seed">
6764
<button type="button" id="reset-seed">&olarr;</button>
68-
<span>&bull;</span>
65+
<br>
66+
<label for="strength">Img2Img Strength:</label>
67+
<input value="0.75" type="number" id="strength" name="strength" step="0.01" min="0" max="1">
68+
<label title="Upload an image to use img2img" for="initimg">Init:</label>
69+
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png">
6970
<button type="button" id="reset-all">Reset to Defaults</button>
7071
<br>
7172
<label for="progress_images">Display in-progress images (slows down generation):</label>

0 commit comments

Comments
 (0)