alexeyGod commited on
Commit
4a0a156
·
verified ·
1 Parent(s): 45fd33c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -3,7 +3,7 @@ import numpy as np
3
  import random
4
 
5
  import spaces #[uncomment to use ZeroGPU]
6
- from diffusers import DiffusionPipeline ,AutoencoderTiny
7
  import torch
8
 
9
  from huggingface_hub import login
@@ -13,10 +13,10 @@ login(token=a )
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  #model_repo_id = "stabilityai/sdxl-turbo" # Replace to the model you would like to use
16
- model_repo_id = "stabilityai/stable-diffusion-xl-base-0.9"
17
-
18
 
19
 
 
20
  if torch.cuda.is_available():
21
  torch_dtype = torch.float16
22
  else:
@@ -24,11 +24,21 @@ else:
24
 
25
  pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
26
  pipe = pipe.to(device)
 
 
27
 
28
  MAX_SEED = np.iinfo(np.int32).max
29
  MAX_IMAGE_SIZE = 1024
30
 
31
 
 
 
 
 
 
 
 
 
32
  # @spaces.GPU #[uncomment to use ZeroGPU]
33
  def infer(
34
  prompt,
 
3
  import random
4
 
5
  import spaces #[uncomment to use ZeroGPU]
6
+ #from diffusers import DiffusionPipeline ,AutoencoderTiny
7
  import torch
8
 
9
  from huggingface_hub import login
 
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  #model_repo_id = "stabilityai/sdxl-turbo" # Replace to the model you would like to use
16
+ #model_repo_id = "stabilityai/stable-diffusion-xl-base-0.9"
 
17
 
18
 
19
+ """
20
  if torch.cuda.is_available():
21
  torch_dtype = torch.float16
22
  else:
 
24
 
25
  pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
26
  pipe = pipe.to(device)
27
+ """
28
+
29
 
30
  MAX_SEED = np.iinfo(np.int32).max
31
  MAX_IMAGE_SIZE = 1024
32
 
33
 
34
+ from diffusers import AutoencoderTiny, StableDiffusionPipeline
35
+
36
+ pipe = StableDiffusionPipeline.from_pretrained(
37
+ "nota-ai/bk-sdm-small", torch_dtype=torch.float16, use_safetensors=True)
38
+ pipe.vae = AutoencoderTiny.from_pretrained(
39
+ "sayakpaul/taesd-diffusers", torch_dtype=torch.float16, use_safetensors=True)
40
+ pipe = pipe.to(device)
41
+
42
  # @spaces.GPU #[uncomment to use ZeroGPU]
43
  def infer(
44
  prompt,