Spaces:
jbilcke-hf
/
Running on A10G

jbilcke-hf HF staff commited on
Commit
99c8f9a
1 Parent(s): 452770a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -9,7 +9,7 @@ import gradio as gr
9
  import numpy as np
10
  import PIL.Image
11
  import torch
12
- from diffusers import DiffusionPipeline
13
 
14
  DESCRIPTION = 'This space is an API service meant to be used by VideoChain and VideoQuest.\nWant to use this space for yourself? Please use the original code: [https://huggingface.co/spaces/hysts/SD-XL](https://huggingface.co/spaces/hysts/SD-XL)'
15
  if not torch.cuda.is_available():
@@ -23,13 +23,16 @@ SECRET_TOKEN = os.getenv('SECRET_TOKEN', 'default_secret')
23
 
24
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
25
  if torch.cuda.is_available():
 
26
  pipe = DiffusionPipeline.from_pretrained(
27
  'stabilityai/stable-diffusion-xl-base-1.0',
 
28
  torch_dtype=torch.float16,
29
  use_safetensors=True,
30
  variant='fp16')
31
  refiner = DiffusionPipeline.from_pretrained(
32
  'stabilityai/stable-diffusion-xl-refiner-1.0',
 
33
  torch_dtype=torch.float16,
34
  use_safetensors=True,
35
  variant='fp16')
 
9
  import numpy as np
10
  import PIL.Image
11
  import torch
12
+ from diffusers import AutoencoderKL, DiffusionPipeline
13
 
14
  DESCRIPTION = 'This space is an API service meant to be used by VideoChain and VideoQuest.\nWant to use this space for yourself? Please use the original code: [https://huggingface.co/spaces/hysts/SD-XL](https://huggingface.co/spaces/hysts/SD-XL)'
15
  if not torch.cuda.is_available():
 
23
 
24
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
25
  if torch.cuda.is_available():
26
+ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
27
  pipe = DiffusionPipeline.from_pretrained(
28
  'stabilityai/stable-diffusion-xl-base-1.0',
29
+ vae=vae,
30
  torch_dtype=torch.float16,
31
  use_safetensors=True,
32
  variant='fp16')
33
  refiner = DiffusionPipeline.from_pretrained(
34
  'stabilityai/stable-diffusion-xl-refiner-1.0',
35
+ vae=vae,
36
  torch_dtype=torch.float16,
37
  use_safetensors=True,
38
  variant='fp16')