Spaces:
Runtime error
Runtime error
Add application file
Browse files- app.py +9 -0
- requirements.txt +6 -0
app.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
|
2 |
+
|
3 |
+
model_id = "stabilityai/stable-diffusion-2"
|
4 |
+
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
5 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
|
6 |
+
pipe = pipe.to("cuda")
|
7 |
+
|
8 |
+
prompt = "a photo of an astronaut riding a horse on mars"
|
9 |
+
image = pipe(prompt).images[0]
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
diffusers
|
3 |
+
transformers
|
4 |
+
accelerate
|
5 |
+
scipy
|
6 |
+
safetensors
|