Prgckwb commited on
Commit
bfc412c
1 Parent(s): 46aec17

:tada: add additional negative embeddings

Browse files
app.py CHANGED
@@ -80,7 +80,7 @@ def inference(
80
  num_inference_steps: int = 50,
81
  num_images: int = 4,
82
  safety_checker: bool = True,
83
- use_model_offload:bool = False,
84
  seed: int = 8888,
85
  progress=gr.Progress(track_tqdm=True),
86
  ) -> Image.Image:
@@ -105,9 +105,9 @@ def inference(
105
  if model_id not in DIFFUSERS_MODEL_IDS:
106
  progress(0.3, 'Loading Textual Inversion...')
107
  # Load Textual Inversion
108
- pipe.load_textual_inversion(
109
- "checkpoints/embeddings/BadNegAnatomyV1 neg.pt", token='BadNegAnatomyV1-neg'
110
- )
111
 
112
  # Generation
113
  progress(0.4, 'Generating images...')
@@ -161,7 +161,7 @@ if __name__ == "__main__":
161
  width = gr.Number(label="Width", value=512, step=64, minimum=64, maximum=2048)
162
  height = gr.Number(label="Height", value=512, step=64, minimum=64, maximum=2048)
163
  num_images = gr.Number(label="Num Images", value=4, minimum=1, maximum=10, step=1)
164
- seed = gr.Number(label="Seed", value=8888, step=1)
165
 
166
  guidance_scale = gr.Slider(label="Guidance Scale", value=7.5, step=0.5, minimum=0, maximum=10)
167
  num_inference_step = gr.Slider(
@@ -172,6 +172,20 @@ if __name__ == "__main__":
172
  use_safety_checker = gr.Checkbox(value=True, label='Use Safety Checker')
173
  use_model_offload = gr.Checkbox(value=False, label='Use Model Offload')
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  with gr.Column():
176
  output_image = gr.Image(label="Image", type="pil")
177
 
 
80
  num_inference_steps: int = 50,
81
  num_images: int = 4,
82
  safety_checker: bool = True,
83
+ use_model_offload: bool = False,
84
  seed: int = 8888,
85
  progress=gr.Progress(track_tqdm=True),
86
  ) -> Image.Image:
 
105
  if model_id not in DIFFUSERS_MODEL_IDS:
106
  progress(0.3, 'Loading Textual Inversion...')
107
  # Load Textual Inversion
108
+ pipe.load_textual_inversion('checkpoints/embeddings/BadNegAnatomyV1 neg.pt', token='BadNegAnatomyV1-neg')
109
+ pipe.load_textual_inversion('checkpoints/embeddings/Deep Negative V1 75T.pt', token='DeepNegativeV1')
110
+ pipe.load_textual_inversion('checkpoints/embeddings/easynegative.safetensors', token='EasyNegative')
111
 
112
  # Generation
113
  progress(0.4, 'Generating images...')
 
161
  width = gr.Number(label="Width", value=512, step=64, minimum=64, maximum=2048)
162
  height = gr.Number(label="Height", value=512, step=64, minimum=64, maximum=2048)
163
  num_images = gr.Number(label="Num Images", value=4, minimum=1, maximum=10, step=1)
164
+ seed = gr.Number(label="Seed", value=8888, step=1)
165
 
166
  guidance_scale = gr.Slider(label="Guidance Scale", value=7.5, step=0.5, minimum=0, maximum=10)
167
  num_inference_step = gr.Slider(
 
172
  use_safety_checker = gr.Checkbox(value=True, label='Use Safety Checker')
173
  use_model_offload = gr.Checkbox(value=False, label='Use Model Offload')
174
 
175
+ with gr.Accordion(label='Notes', open=False):
176
+ # language=HTML
177
+ notes = gr.HTML(
178
+ """
179
+ <h2>Negative Embeddings</h2>
180
+ <p>If you want to use negative embedding, use the following tokens in the prompt.</p>
181
+ <ul>
182
+ <li><a href='https://civitai.com/models/59614/badneganatomy-textual-inversion'>BadNegAnatomyV1-neg</a></li>
183
+ <li><a href='https://civitai.com/models/4629/deep-negative-v1x'>DeepNegativeV1</a> </li>
184
+ <li><a href='https://civitai.com/models/7808/easynegative'>EasyNegative</a></li>
185
+ </ul>
186
+ """
187
+ )
188
+
189
  with gr.Column():
190
  output_image = gr.Image(label="Image", type="pil")
191
 
checkpoints/embeddings/Deep Negative V1 75T.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54e7e4826d53949a3d0dde40aea023b1e456a618c608a7630e3999fd38f93245
3
+ size 231339
checkpoints/embeddings/easynegative.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c74b4e810b030f6b75fde959e2db678c268d07115b85356d3c0138ba5eb42340
3
+ size 24655