Update handler.py
Browse files- handler.py +2 -0
handler.py
CHANGED
@@ -4,6 +4,7 @@ import torch
|
|
4 |
import base64
|
5 |
import logging
|
6 |
import numpy as np
|
|
|
7 |
from PIL import Image
|
8 |
from io import BytesIO
|
9 |
import subprocess
|
@@ -50,4 +51,5 @@ class EndpointHandler:
|
|
50 |
except Exception as e:
|
51 |
logger.error(str(e))
|
52 |
del inputs
|
|
|
53 |
torch.cuda.empty_cache()
|
|
|
4 |
import base64
|
5 |
import logging
|
6 |
import numpy as np
|
7 |
+
import gc
|
8 |
from PIL import Image
|
9 |
from io import BytesIO
|
10 |
import subprocess
|
|
|
51 |
except Exception as e:
|
52 |
logger.error(str(e))
|
53 |
del inputs
|
54 |
+
gc.collect()
|
55 |
torch.cuda.empty_cache()
|