s-ahal commited on
Commit
9940d16
·
verified ·
1 Parent(s): 8755d3c

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +9 -0
server.py CHANGED
@@ -7,6 +7,15 @@ import os
7
  from PIL import Image
8
  from transformers import CLIPProcessor, CLIPModel
9
  import numpy as np
 
 
 
 
 
 
 
 
 
10
 
11
  # Define the MIDM model
12
  class MIDM(nn.Module):
 
7
  from PIL import Image
8
  from transformers import CLIPProcessor, CLIPModel
9
  import numpy as np
10
+ import shutil
11
+ import os
12
+ from transformers import CLIPProcessor, CLIPModel
13
+
14
+ # Clear the cache before loading the model
15
+ cache_dir = os.path.expanduser("~/.cache/huggingface")
16
+ if os.path.exists(cache_dir):
17
+ shutil.rmtree(cache_dir)
18
+ print("Cache cleared.")
19
 
20
  # Define the MIDM model
21
  class MIDM(nn.Module):