isaul19
commited on
Commit
·
e2cc4e8
1
Parent(s):
f102a76
base v2
Browse files- cache/.gitkeep +0 -0
- main.py +5 -7
cache/.gitkeep
ADDED
|
File without changes
|
main.py
CHANGED
|
@@ -16,23 +16,21 @@ app.add_middleware(
|
|
| 16 |
allow_headers=["*"]
|
| 17 |
)
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
# MODEL 1.4
|
| 22 |
model_id = "CompVis/stable-diffusion-v1-4"
|
| 23 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 24 |
|
| 25 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 26 |
-
model_id, torch_dtype=torch.float32
|
| 27 |
-
|
| 28 |
-
pipe = pipe.to(device)
|
| 29 |
|
| 30 |
-
#
|
| 31 |
# model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 32 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 33 |
# pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32, use_safetensors=True, variant="fp16")
|
| 34 |
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
@app.get("/")
|
| 38 |
def generate(prompt: str):
|
|
|
|
| 16 |
allow_headers=["*"]
|
| 17 |
)
|
| 18 |
|
|
|
|
|
|
|
| 19 |
# MODEL 1.4
|
| 20 |
model_id = "CompVis/stable-diffusion-v1-4"
|
| 21 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 22 |
|
| 23 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 24 |
+
model_id, torch_dtype=torch.float32, cache_dir="/cache/"
|
| 25 |
+
)
|
|
|
|
| 26 |
|
| 27 |
+
# MOdel 1.0
|
| 28 |
# model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 29 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 30 |
# pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32, use_safetensors=True, variant="fp16")
|
| 31 |
|
| 32 |
+
pipe = pipe.to(device)
|
| 33 |
+
|
| 34 |
|
| 35 |
@app.get("/")
|
| 36 |
def generate(prompt: str):
|