alfredplpl commited on
Commit
4dc2497
1 Parent(s): a359dcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -24,7 +24,6 @@ pipe = AutoPipelineForText2Image.from_pretrained(
24
  scheduler=scheduler,
25
  token=auth_token)
26
 
27
- pipe.to("cuda")
28
  pipe.enable_freeu(s1=0.9, s2=0.2, b1=1.3, b2=1.4)
29
 
30
  state_dict = load_file("unaestheticXLv31.safetensors")
@@ -36,13 +35,13 @@ compel = Compel(tokenizer=[pipe.tokenizer, pipe.tokenizer_2] ,
36
  returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
37
  requires_pooled=[False, True])
38
 
 
 
39
  def error_str(error, title="Error"):
40
  return f"""#### {title}
41
  {error}""" if error else ""
42
 
43
  def inference(prompt, guidance, steps, seed=0, neg_prompt="", disable_auto_prompt_correction=False):
44
- global pipe
45
-
46
  generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
47
 
48
  prompt,neg_prompt=auto_prompt_correction(prompt,neg_prompt,disable_auto_prompt_correction)
@@ -99,7 +98,6 @@ def auto_prompt_correction(prompt_ui,neg_prompt_ui,disable_auto_prompt_correctio
99
  def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
100
  conditioning, pooled = compel(prompt)
101
  neg_conditioning, neg_pooled = compel(neg_prompt)
102
-
103
 
104
  result = pipe(
105
  prompt_embeds=conditioning,
 
24
  scheduler=scheduler,
25
  token=auth_token)
26
 
 
27
  pipe.enable_freeu(s1=0.9, s2=0.2, b1=1.3, b2=1.4)
28
 
29
  state_dict = load_file("unaestheticXLv31.safetensors")
 
35
  returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
36
  requires_pooled=[False, True])
37
 
38
+ pipe=pipe.to("cuda")
39
+
40
  def error_str(error, title="Error"):
41
  return f"""#### {title}
42
  {error}""" if error else ""
43
 
44
  def inference(prompt, guidance, steps, seed=0, neg_prompt="", disable_auto_prompt_correction=False):
 
 
45
  generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
46
 
47
  prompt,neg_prompt=auto_prompt_correction(prompt,neg_prompt,disable_auto_prompt_correction)
 
98
  def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
99
  conditioning, pooled = compel(prompt)
100
  neg_conditioning, neg_pooled = compel(neg_prompt)
 
101
 
102
  result = pipe(
103
  prompt_embeds=conditioning,