Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,9 +21,8 @@ def print_memory_info():
|
|
| 21 |
logger.info(f"Free GPU Memory: {free_gpu_mem:.2f} GB")
|
| 22 |
|
| 23 |
|
| 24 |
-
|
| 25 |
def load_image_model():
|
| 26 |
-
print_memory_info()
|
| 27 |
torch.cuda.empty_cache()
|
| 28 |
pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", variant='fp16')
|
| 29 |
pipeline.to("cuda")
|
|
@@ -31,5 +30,6 @@ def load_image_model():
|
|
| 31 |
return pipeline
|
| 32 |
|
| 33 |
|
|
|
|
| 34 |
image_service = load_image_model()
|
| 35 |
-
|
|
|
|
| 21 |
logger.info(f"Free GPU Memory: {free_gpu_mem:.2f} GB")
|
| 22 |
|
| 23 |
|
| 24 |
+
@st.cache_resource
|
| 25 |
def load_image_model():
|
|
|
|
| 26 |
torch.cuda.empty_cache()
|
| 27 |
pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", variant='fp16')
|
| 28 |
pipeline.to("cuda")
|
|
|
|
| 30 |
return pipeline
|
| 31 |
|
| 32 |
|
| 33 |
+
print_memory_info()
|
| 34 |
image_service = load_image_model()
|
| 35 |
+
print_memory_info()
|