nigeljw commited on
Commit
ff90cd8
1 Parent(s): 1966b50

Added info descriptions and also fixed guidance scale

Browse files
Files changed (1) hide show
  1. app.py +16 -7
app.py CHANGED
@@ -63,18 +63,27 @@ def diffuse(staticLatents, generatorSeed, inputImage, mask, pauseInference, prom
63
  return newImage
64
 
65
  defaultMask = Image.open("assets/masks/diamond.png")
 
 
 
 
 
 
66
 
67
- prompt = gradio.Textbox(label="Prompt", placeholder="A person in a room", lines=3)
68
- negativePrompt = gradio.Textbox(label="Negative Prompt", placeholder="Text", lines=3)
69
  inputImage = gradio.Image(label="Input Feed", source="webcam", shape=[512,512], streaming=True)
70
  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
- 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()
 
63
  return newImage
64
 
65
  defaultMask = Image.open("assets/masks/diamond.png")
66
+ numInfStepsDesc = "A higher value generally increases quality, but reduces the frames per second of the output stream."
67
+ staticLatentsDesc = "This setting increases the frame to frame determisn of the generation. If this is disabled, then the inerence will take continous large walks across the latent space between frames."
68
+ generatorSeedDesc = "Identical seeds allow for persistent scene generation between runs, and changing the seed will take a static large walk across the latent space to better control and alter the generation of scene scene content."
69
+ promptDesc = "This text will condition the generation of the scene to help guide the content creation."
70
+ negPromptDesc = "This text will help deter the generation from converging towards reconstructing the elements described in the text."
71
+ outputText = "This inferred imagery expands the field of view from the masked area of the input camera feed."
72
 
73
+ prompt = gradio.Textbox(label="Prompt", info=promptDesc, placeholder="A person in a room", lines=3)
74
+ negativePrompt = gradio.Textbox(label="Negative Prompt", info=negPromptDesc, placeholder="Facial hair", lines=3)
75
  inputImage = gradio.Image(label="Input Feed", source="webcam", shape=[512,512], streaming=True)
76
  mask = gradio.Image(label="Mask", type="pil", value=defaultMask)
77
  outputImage = gradio.Image(label="Extrapolated Field of View")
78
+ guidanceScale = gradio.Slider(label="Guidance Scale", info="A higher value causes the generation to be more relative to the text prompt conditioning.", maximum=100, minimum=1, value=7.5)
79
+ numInferenceSteps = gradio.Slider(label="Number of Inference Steps", info=numInfStepsDesc, maximum=100, minimum=1, value=20)
80
+ generatorSeed = gradio.Slider(label="Generator Seed", info=generatorSeedDesc, maximum=10000, value=lastSeed)
81
+ staticLatents = gradio.Checkbox(label="Static Latents", info=staticLatentsDesc, value=True)
82
  pauseInference = gradio.Checkbox(label="Pause Inference", value=False)
83
 
84
+ description = "This generative machine learning demonstration streams stable diffusion outpainting inference live from your camera on your computer or phone to expand your local reality and create an alternate world. High quality frame to frame determinism is a hard problem to solve for latent diffusion models as the generation is inherently relative to input noise distributions for the latents, and many factors such as the inherent Bayer noise from the camera images as well as anything that is altered between camera images (such as focus, white balance, etc). Some methods apply spationtemporal attention, but this demonstration focuses on the control over the input latents to navigate the latent space. Increase the lighting of your physical scene to improve the quality and consistency."
85
+ article = "This demonstration should initialize automatically, and run relatively well, but if the output is not an ideal reconstruction of your physical local space from caemra's perspective, then you should adjust the generator seed to take larger walks across the latent space. In addition, the static latents can be disable to continously walk the latent space, but this will increase frame to fram non-determinism. You can also condition the generation using prompts to re-enforce or change aspects of the scene. If you see a black image instead of a generated output image, then you are running into the safety checker. This can trigger inconsistently even when the generated content is purely PG. If this happens, then increase the lighting of the scene and also increase the number of inference steps to improve the generated predicition."
86
+
87
  inputs=[staticLatents, generatorSeed, inputImage, mask, pauseInference, prompt, negativePrompt, guidanceScale, numInferenceSteps]
88
+ ux = gradio.Interface(fn=diffuse, title="View Diffusion", article=article, description=description, inputs=inputs, outputs=outputImage, live=True)
89
  ux.launch()