Spaces:
Build error
Build error
Zhenhong
commited on
Commit
·
fc09f75
1
Parent(s):
bb9a6c3
Add application file
Browse files- app.py +4 -6
- requirements.txt +2 -1
app.py
CHANGED
@@ -4,15 +4,13 @@ import torch
|
|
4 |
|
5 |
model_id = "runwayml/stable-diffusion-v1-5"
|
6 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
|
7 |
-
|
8 |
|
9 |
-
prompt = "a photo of an astronaut riding a horse on mars"
|
10 |
-
|
11 |
# image.save("astronaut_rides_horse.png")
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
image = pipe(prompt).images[0]
|
16 |
|
17 |
return image
|
18 |
|
|
|
4 |
|
5 |
model_id = "runwayml/stable-diffusion-v1-5"
|
6 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
|
7 |
+
pipe = pipe.to("cuda")
|
8 |
|
9 |
+
# prompt = "a photo of an astronaut riding a horse on mars"
|
|
|
10 |
# image.save("astronaut_rides_horse.png")
|
11 |
|
12 |
+
def infer(Prompt):
|
13 |
+
image = pipe(Prompt).images[0]
|
|
|
14 |
|
15 |
return image
|
16 |
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
git+https://github.com/huggingface/transformers.git
|
2 |
git+https://github.com/huggingface/diffusers.git
|
3 |
-
torch
|
|
|
|
1 |
git+https://github.com/huggingface/transformers.git
|
2 |
git+https://github.com/huggingface/diffusers.git
|
3 |
+
torch
|
4 |
+
accelerate
|