SMarioMan commited on
Commit
b723632
·
1 Parent(s): c6c1dd3

Add negative prompt support

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -58,12 +58,13 @@ pipe.load_lora_weights("latent-consistency/lcm-lora-sdv1-5")
58
  pipe.fuse_lora()
59
 
60
 
61
- def predict(prompt, guidance, steps, seed=1231231):
62
  generator = torch.manual_seed(seed)
63
  last_time = time.time()
64
  results = pipe(
65
  prompt=prompt,
66
  generator=generator,
 
67
  num_inference_steps=steps,
68
  guidance_scale=guidance,
69
  width=512,
@@ -107,6 +108,9 @@ with gr.Blocks(css=css) as demo:
107
  prompt = gr.Textbox(
108
  placeholder="Insert your prompt here:", scale=5, container=False
109
  )
 
 
 
110
  generate_bt = gr.Button("Generate", scale=1)
111
 
112
  image = gr.Image(type="filepath")
@@ -114,7 +118,7 @@ with gr.Blocks(css=css) as demo:
114
  guidance = gr.Slider(
115
  label="Guidance", minimum=0.0, maximum=5, value=0.3, step=0.001
116
  )
117
- steps = gr.Slider(label="Steps", value=4, minimum=2, maximum=10, step=1)
118
  seed = gr.Slider(
119
  randomize=True, minimum=0, maximum=12013012031030, label="Seed", step=1
120
  )
 
58
  pipe.fuse_lora()
59
 
60
 
61
+ def predict(prompt, negative_prompt, guidance, steps, seed=1231231):
62
  generator = torch.manual_seed(seed)
63
  last_time = time.time()
64
  results = pipe(
65
  prompt=prompt,
66
  generator=generator,
67
+ negative_prompt=negative_prompt,
68
  num_inference_steps=steps,
69
  guidance_scale=guidance,
70
  width=512,
 
108
  prompt = gr.Textbox(
109
  placeholder="Insert your prompt here:", scale=5, container=False
110
  )
111
+ negative_prompt = gr.Textbox(
112
+ placeholder="Insert your negative prompt here:", scale=5, container=False
113
+ )
114
  generate_bt = gr.Button("Generate", scale=1)
115
 
116
  image = gr.Image(type="filepath")
 
118
  guidance = gr.Slider(
119
  label="Guidance", minimum=0.0, maximum=5, value=0.3, step=0.001
120
  )
121
+ steps = gr.Slider(label="Steps", value=4, minimum=1, maximum=20, step=1)
122
  seed = gr.Slider(
123
  randomize=True, minimum=0, maximum=12013012031030, label="Seed", step=1
124
  )