nigeljw commited on
Commit
4be1d13
1 Parent(s): c64ae1b

Added default prompts and fixed inference pause control

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -65,7 +65,7 @@ def Slerp(start, end, alpha):
65
  second = torch.sin(alpha*omega)/sinOmega
66
  return first.unsqueeze(1)*start + second.unsqueeze(1)*end
67
 
68
- def Diffuse(latentWalk, generatorSeed, inputImage, mask, prompt, negativePrompt, guidanceScale, numInferenceSteps):
69
  global lastImage, lastSeed, generator, oldLatentWalk, activeLatents
70
 
71
  if mask is None or pauseInference is True:
@@ -130,8 +130,8 @@ with gradio.Blocks(live=True) as ux:
130
  #staticLatents = gradio.Checkbox(label="Static Latents", info=staticLatentsDesc, value=True, interactive=True)
131
  inputImage = gradio.Image(label="Input Feed", source="webcam", shape=[512,512], streaming=True)
132
  mask = gradio.Image(label="Mask", type="pil", value=defaultMask)
133
- prompt = gradio.Textbox(label="Prompt", info=promptDesc, placeholder=examplePrompt1, lines=3)
134
- negativePrompt = gradio.Textbox(label="Negative Prompt", info=negPromptDesc, placeholder="Facial hair", lines=3)
135
  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, step= 0.1)
136
  numInferenceSteps = gradio.Slider(label="Number of Inference Steps", info=numInfStepsDesc, maximum=100, minimum=1, value=20, step=1)
137
  generatorSeed = gradio.Slider(label="Generator Seed", info=generatorSeedDesc, maximum=10000, minimum=1, value=lastSeed, step=1)
@@ -145,7 +145,7 @@ with gradio.Blocks(live=True) as ux:
145
  outputImage = gradio.Image(label="Extrapolated Field of View")
146
  pauseInference = gradio.Checkbox(label="Pause Inference", value=False)
147
 
148
- inferenceInputs = [latentWalk, generatorSeed, inputImage, mask, prompt, negativePrompt, guidanceScale, numInferenceSteps]
149
  generateLatents.click(GenerateNewLatentsForInference, outputs=latentWalk)
150
  inputImage.change(fn=Diffuse, inputs=inferenceInputs, outputs=outputImage, show_progress=False)
151
 
@@ -165,4 +165,4 @@ with gradio.Blocks(live=True) as ux:
165
  #ux = gradio.Interface(fn=diffuse, title="View Diffusion", article=article, description=description, inputs=inputs, outputs=outputImage, examples=inputExamples, live=True)
166
 
167
  print("Launching Demo")
168
- ux.launch()
 
65
  second = torch.sin(alpha*omega)/sinOmega
66
  return first.unsqueeze(1)*start + second.unsqueeze(1)*end
67
 
68
+ def Diffuse(latentWalk, generatorSeed, inputImage, mask, prompt, negativePrompt, guidanceScale, numInferenceSteps, pauseInference):
69
  global lastImage, lastSeed, generator, oldLatentWalk, activeLatents
70
 
71
  if mask is None or pauseInference is True:
 
130
  #staticLatents = gradio.Checkbox(label="Static Latents", info=staticLatentsDesc, value=True, interactive=True)
131
  inputImage = gradio.Image(label="Input Feed", source="webcam", shape=[512,512], streaming=True)
132
  mask = gradio.Image(label="Mask", type="pil", value=defaultMask)
133
+ prompt = gradio.Textbox(label="Prompt", info=promptDesc, placeholder=examplePrompt1, value="A person", lines=3)
134
+ negativePrompt = gradio.Textbox(label="Negative Prompt", info=negPromptDesc, placeholder="Facial hair", value="Text, words", lines=3)
135
  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, step= 0.1)
136
  numInferenceSteps = gradio.Slider(label="Number of Inference Steps", info=numInfStepsDesc, maximum=100, minimum=1, value=20, step=1)
137
  generatorSeed = gradio.Slider(label="Generator Seed", info=generatorSeedDesc, maximum=10000, minimum=1, value=lastSeed, step=1)
 
145
  outputImage = gradio.Image(label="Extrapolated Field of View")
146
  pauseInference = gradio.Checkbox(label="Pause Inference", value=False)
147
 
148
+ inferenceInputs = [latentWalk, generatorSeed, inputImage, mask, prompt, negativePrompt, guidanceScale, numInferenceSteps, pauseInference]
149
  generateLatents.click(GenerateNewLatentsForInference, outputs=latentWalk)
150
  inputImage.change(fn=Diffuse, inputs=inferenceInputs, outputs=outputImage, show_progress=False)
151
 
 
165
  #ux = gradio.Interface(fn=diffuse, title="View Diffusion", article=article, description=description, inputs=inputs, outputs=outputImage, examples=inputExamples, live=True)
166
 
167
  print("Launching Demo")
168
+ ux.launch() #debug=True)