Profakerr commited on
Commit
5e19969
·
verified ·
1 Parent(s): 7410ac3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler, AutoencoderKL
2
  from transformers import CLIPTextModel, CLIPTokenizer
3
  import torch
4
  import gradio as gr
@@ -7,8 +7,6 @@ import spaces
7
 
8
  lora1 = "OedoSoldier/detail-tweaker-lora"
9
 
10
- vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse").to("cuda")
11
-
12
  @spaces.GPU
13
  def generate_image(prompt, negative_prompt, num_inference_steps=30, guidance_scale=7.0,model="Real6.0",num_images=1, width=512, height=512):
14
 
@@ -20,7 +18,12 @@ def generate_image(prompt, negative_prompt, num_inference_steps=30, guidance_sca
20
 
21
  else:
22
  model_id = "SG161222/Realistic_Vision_V6.0_B1_noVAE"
23
-
 
 
 
 
 
24
 
25
  text_encoder = CLIPTextModel.from_pretrained(
26
  model_id,
@@ -31,6 +34,11 @@ def generate_image(prompt, negative_prompt, num_inference_steps=30, guidance_sca
31
  model_id,
32
  subfolder="tokenizer"
33
  )
 
 
 
 
 
34
 
35
  pipe = DiffusionPipeline.from_pretrained(
36
  model_id,
 
1
+ from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler, AutoencoderKL, UNet2DConditionModel
2
  from transformers import CLIPTextModel, CLIPTokenizer
3
  import torch
4
  import gradio as gr
 
7
 
8
  lora1 = "OedoSoldier/detail-tweaker-lora"
9
 
 
 
10
  @spaces.GPU
11
  def generate_image(prompt, negative_prompt, num_inference_steps=30, guidance_scale=7.0,model="Real6.0",num_images=1, width=512, height=512):
12
 
 
18
 
19
  else:
20
  model_id = "SG161222/Realistic_Vision_V6.0_B1_noVAE"
21
+
22
+
23
+ vae = AutoencoderKL.from_pretrained(
24
+ model_id,
25
+ subfolder="vae"
26
+ ).to("cuda")
27
 
28
  text_encoder = CLIPTextModel.from_pretrained(
29
  model_id,
 
34
  model_id,
35
  subfolder="tokenizer"
36
  )
37
+
38
+ unet = UNet2DConditionModel.from_pretrained(
39
+ model_id,
40
+ subfolder="unet"
41
+ ).to("cuda")
42
 
43
  pipe = DiffusionPipeline.from_pretrained(
44
  model_id,