Spaces:
Runtime error
Runtime error
Sophia Yang
commited on
Commit
·
80ba4d1
1
Parent(s):
a0019ba
cache
Browse files
app.py
CHANGED
|
@@ -17,9 +17,13 @@ pn.state.template.param.update(
|
|
| 17 |
)
|
| 18 |
|
| 19 |
model_id = "timbrooks/instruct-pix2pix"
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
def normalize_image(value, width):
|
| 25 |
"""
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
model_id = "timbrooks/instruct-pix2pix"
|
| 20 |
+
|
| 21 |
+
if 'pipe' in pn.state.cache:
|
| 22 |
+
pipe = pn.state.cache['pipe']
|
| 23 |
+
else:
|
| 24 |
+
pipe = pn.state.cache['pipe'] = StableDiffusionInstructPix2PixPipeline.from_pretrained(
|
| 25 |
+
model_id, torch_dtype=torch.float16
|
| 26 |
+
).to("cuda")
|
| 27 |
|
| 28 |
def normalize_image(value, width):
|
| 29 |
"""
|