ysharma HF staff commited on
Commit
27df046
1 Parent(s): 3bb26ab
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -12,16 +12,14 @@ device = th.device('cpu' if not th.cuda.is_available() else 'cuda')
12
  print(f"device is :{device}")
13
 
14
  # init stable diffusion model
15
- pipe = StableDiffusionPipeline.from_pretrained(
16
- "CompVis/stable-diffusion-v1-4",
17
- use_auth_token= HF_TOKEN).to(device)
18
 
19
  def get_sd(translated_txt):
20
  scale=7.5
21
  steps=45
22
  with autocast('cpu' if not th.cuda.is_available() else 'cuda'):
23
  image = pipe(translated_txt, guidance_scale=scale, num_inference_steps=steps)["sample"][0]
24
- return image
25
 
26
  #API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
27
  #HF_TOKEN = os.environ.get("diffuse_new") or True
 
12
  print(f"device is :{device}")
13
 
14
  # init stable diffusion model
15
+ pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, use_auth_token= HF_TOKEN).to(device)
 
 
16
 
17
  def get_sd(translated_txt):
18
  scale=7.5
19
  steps=45
20
  with autocast('cpu' if not th.cuda.is_available() else 'cuda'):
21
  image = pipe(translated_txt, guidance_scale=scale, num_inference_steps=steps)["sample"][0]
22
+ return image
23
 
24
  #API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
25
  #HF_TOKEN = os.environ.get("diffuse_new") or True