This commit is contained in:
caranicas 2022-09-17 16:30:47 -04:00
parent 4fbc46b3b3
commit 1e9e9daeb3
3 changed files with 64 additions and 49 deletions

View File

@ -17,7 +17,7 @@
<!-- WE NEED TO PORT OVER THE STYLES OVER TO THE REACT COMPONENTS --> <!-- WE NEED TO PORT OVER THE STYLES OVER TO THE REACT COMPONENTS -->
<style> <style>
body { body {
font-family: Arial, Helvetica, sans-serif; /* font-family: Arial, Helvetica, sans-serif; */
font-size: 11pt; font-size: 11pt;
background-color: rgb(32, 33, 36); background-color: rgb(32, 33, 36);
color: #eee; color: #eee;

View File

@ -38,9 +38,18 @@ export default function PropertySettings() {
const guidance_scale = useImageCreate((state) => const guidance_scale = useImageCreate((state) =>
state.getValueForRequestKey("guidance_scale") state.getValueForRequestKey("guidance_scale")
); );
const init_image = useImageCreate((state) =>
state.getValueForRequestKey("init_image")
);
const prompt_strength = useImageCreate((state) => const prompt_strength = useImageCreate((state) =>
state.getValueForRequestKey("prompt_strength") state.getValueForRequestKey("prompt_strength")
); );
const width = useImageCreate((state) => state.getValueForRequestKey("width")); const width = useImageCreate((state) => state.getValueForRequestKey("width"));
const height = useImageCreate((state) => const height = useImageCreate((state) =>
state.getValueForRequestKey("height") state.getValueForRequestKey("height")
@ -109,23 +118,24 @@ export default function PropertySettings() {
<span>{guidance_scale}</span> <span>{guidance_scale}</span>
</div> </div>
<div className="mb-4"> {init_image && (
<label> <div>
Prompt Strength:{" "} <label>
<input Prompt Strength:{" "}
value={prompt_strength} <input
onChange={(e) => value={prompt_strength}
// setImageOptions({ promptStrength: Number(e.target.value) }) onChange={(e) =>
setRequestOption("prompt_strength", e.target.value) setRequestOption("prompt_strength", e.target.value)
} }
type="range" type="range"
min="0" min="0"
max="1" max="1"
step=".05" step=".05"
/> />
</label> </label>
<span>{prompt_strength}</span> <span>{prompt_strength}</span>
</div> </div>
)}
<div> <div>
<label> <label>

View File

@ -17,37 +17,37 @@ export type ImageRequest = {
num_inference_steps: number; num_inference_steps: number;
guidance_scale: number; guidance_scale: number;
width: width:
| 128 | 128
| 192 | 192
| 256 | 256
| 320 | 320
| 384 | 384
| 448 | 448
| 512 | 512
| 576 | 576
| 640 | 640
| 704 | 704
| 768 | 768
| 832 | 832
| 896 | 896
| 960 | 960
| 1024; | 1024;
height: height:
| 128 | 128
| 192 | 192
| 256 | 256
| 320 | 320
| 384 | 384
| 448 | 448
| 512 | 512
| 576 | 576
| 640 | 640
| 704 | 704
| 768 | 768
| 832 | 832
| 896 | 896
| 960 | 960
| 1024; | 1024;
// allow_nsfw: boolean; // allow_nsfw: boolean;
turbo: boolean; turbo: boolean;
use_cpu: boolean; use_cpu: boolean;
@ -211,6 +211,11 @@ export const useImageCreate = create<ImageCreateState>(
request.use_upscale = null; request.use_upscale = null;
} }
if (void 0 === requestOptions.init_image) {
request.prompt_strength = undefined;
}
return request; return request;
}, },
@ -219,7 +224,7 @@ export const useImageCreate = create<ImageCreateState>(
produce((state) => { produce((state) => {
const isSeting = const isSeting =
typeof state.getValueForRequestKey("use_face_correction") === typeof state.getValueForRequestKey("use_face_correction") ===
"string" "string"
? null ? null
: "GFPGANv1.3"; : "GFPGANv1.3";
state.requestOptions.use_face_correction = isSeting; state.requestOptions.use_face_correction = isSeting;