Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -118,6 +118,9 @@ def clean_memory():
|
|
118 |
gc.collect()
|
119 |
if torch.cuda.is_available():
|
120 |
torch.cuda.empty_cache()
|
|
|
|
|
|
|
121 |
logger.info("Memory cleaned")
|
122 |
|
123 |
def predict(image):
|
|
|
118 |
gc.collect()
|
119 |
if torch.cuda.is_available():
|
120 |
torch.cuda.empty_cache()
|
121 |
+
# Clear GPU cache
|
122 |
+
torch.cuda.empty_cache()
|
123 |
+
logger.info(f"Memory allocated after clearing cache: {torch.cuda.memory_allocated()} bytes")
|
124 |
logger.info("Memory cleaned")
|
125 |
|
126 |
def predict(image):
|