tombetthauser commited on
Commit
cd7f3ee
Β·
1 Parent(s): 829fa44

Import os for env vars

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -6,16 +6,14 @@ import gradio
6
  from diffusers import StableDiffusionPipeline as pipeline
7
  from accelerate import init_empty_weights
8
  import torch
 
9
 
10
- from PIL import Image
11
- import matplotlib.pyplot as plot
12
-
13
  my_token = api_key
14
 
15
  with init_empty_weights():
16
  pipe = pipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, use_auth_token=my_token).to("cuda")
17
 
18
-
19
  def image_prompt(thing):
20
  prompt = "A children's drawing of a " + thing
21
  return pipe(prompt=prompt, height=512, width=664).images[0]
 
6
  from diffusers import StableDiffusionPipeline as pipeline
7
  from accelerate import init_empty_weights
8
  import torch
9
+ import os
10
 
11
+ api_key = os.environ['api_key']
 
 
12
  my_token = api_key
13
 
14
  with init_empty_weights():
15
  pipe = pipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, use_auth_token=my_token).to("cuda")
16
 
 
17
  def image_prompt(thing):
18
  prompt = "A children's drawing of a " + thing
19
  return pipe(prompt=prompt, height=512, width=664).images[0]