Spaces:
Paused
Paused
First release!
Browse files
app.py
CHANGED
@@ -28,15 +28,15 @@ else:
|
|
28 |
pipeline = StableDiffusionInpaintPipeline.from_pretrained("runwayml/stable-diffusion-inpainting")
|
29 |
#safety_checker=lambda images, **kwargs: (images, False))
|
30 |
|
31 |
-
GenerateNewLatentsForInference()
|
32 |
-
|
33 |
imageSize = (512, 512)
|
34 |
lastImage = Image.new(mode="RGB", size=imageSize)
|
35 |
|
36 |
-
lastSeed =
|
37 |
-
generator = torch.Generator(device).manual_seed(
|
|
|
|
|
38 |
|
39 |
-
def diffuse(staticLatents, inputImage, mask, pauseInference, prompt, negativePrompt, guidanceScale, numInferenceSteps
|
40 |
global latents, lastSeed, generator, deviceStr, lastImage
|
41 |
|
42 |
if mask is None or pauseInference is True:
|
@@ -45,9 +45,9 @@ def diffuse(staticLatents, inputImage, mask, pauseInference, prompt, negativePro
|
|
45 |
if staticLatents is False:
|
46 |
GenerateNewLatentsForInference()
|
47 |
|
48 |
-
if lastSeed !=
|
49 |
-
generator = torch.Generator(device).manual_seed(
|
50 |
-
lastSeed =
|
51 |
|
52 |
newImage = pipeline(prompt=prompt,
|
53 |
negative_prompt=negativePrompt,
|
@@ -71,12 +71,10 @@ mask = gradio.Image(label="Mask", type="pil", value=defaultMask)
|
|
71 |
outputImage = gradio.Image(label="Extrapolated Field of View")
|
72 |
guidanceScale = gradio.Slider(label="Guidance Scale", maximum=1, value=0.75)
|
73 |
numInferenceSteps = gradio.Slider(label="Number of Inference Steps", maximum=100, value=25)
|
74 |
-
|
75 |
staticLatents =gradio.Checkbox(label="Static Latents", value=True)
|
76 |
pauseInference = gradio.Checkbox(label="Pause Inference", value=False)
|
77 |
-
#generateNewLatents = gradio.Button(label="Generate New Latents")
|
78 |
-
#generateNewLatents.click(GenerateNewLatentsForInference)
|
79 |
|
80 |
-
inputs=[staticLatents, inputImage, mask, pauseInference, prompt, negativePrompt, guidanceScale, numInferenceSteps
|
81 |
ux = gradio.Interface(fn=diffuse, title="View Diffusion", inputs=inputs, outputs=outputImage, live=True)
|
82 |
ux.launch()
|
|
|
28 |
pipeline = StableDiffusionInpaintPipeline.from_pretrained("runwayml/stable-diffusion-inpainting")
|
29 |
#safety_checker=lambda images, **kwargs: (images, False))
|
30 |
|
|
|
|
|
31 |
imageSize = (512, 512)
|
32 |
lastImage = Image.new(mode="RGB", size=imageSize)
|
33 |
|
34 |
+
lastSeed = 4096
|
35 |
+
generator = torch.Generator(device).manual_seed(lastSeed)
|
36 |
+
|
37 |
+
GenerateNewLatentsForInference()
|
38 |
|
39 |
+
def diffuse(staticLatents, generatorSeed, inputImage, mask, pauseInference, prompt, negativePrompt, guidanceScale, numInferenceSteps):
|
40 |
global latents, lastSeed, generator, deviceStr, lastImage
|
41 |
|
42 |
if mask is None or pauseInference is True:
|
|
|
45 |
if staticLatents is False:
|
46 |
GenerateNewLatentsForInference()
|
47 |
|
48 |
+
if lastSeed != generatorSeed:
|
49 |
+
generator = torch.Generator(device).manual_seed(generatorSeed)
|
50 |
+
lastSeed = generatorSeed
|
51 |
|
52 |
newImage = pipeline(prompt=prompt,
|
53 |
negative_prompt=negativePrompt,
|
|
|
71 |
outputImage = gradio.Image(label="Extrapolated Field of View")
|
72 |
guidanceScale = gradio.Slider(label="Guidance Scale", maximum=1, value=0.75)
|
73 |
numInferenceSteps = gradio.Slider(label="Number of Inference Steps", maximum=100, value=25)
|
74 |
+
generatorSeed = gradio.Slider(label="Generator Seed", maximum=10000, value=lastSeed)
|
75 |
staticLatents =gradio.Checkbox(label="Static Latents", value=True)
|
76 |
pauseInference = gradio.Checkbox(label="Pause Inference", value=False)
|
|
|
|
|
77 |
|
78 |
+
inputs=[staticLatents, generatorSeed, inputImage, mask, pauseInference, prompt, negativePrompt, guidanceScale, numInferenceSteps]
|
79 |
ux = gradio.Interface(fn=diffuse, title="View Diffusion", inputs=inputs, outputs=outputImage, live=True)
|
80 |
ux.launch()
|