sergeipetrov commited on
Commit
426d898
·
verified ·
1 Parent(s): 29957a2

Update handler.py

Browse files
Files changed (1) hide show
  1. 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()