Spaces:
Runtime error
Runtime error
Commit
Β·
cd7f3ee
1
Parent(s):
829fa44
Import os for env vars
Browse files
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 |
-
|
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]
|