yoinked commited on
Commit
30da86e
1 Parent(s): 7d57a3e
Files changed (1) hide show
  1. app.py +0 -10
app.py CHANGED
@@ -51,7 +51,6 @@ class WaifuDiffusionInterrogator:
51
 
52
  self.__initialized = False
53
  self._model, self._tags = None, None
54
- self.cache = {}
55
  def _init(self) -> None:
56
  if self.__initialized:
57
  return
@@ -100,11 +99,6 @@ class WaifuDiffusionInterrogator:
100
  return full_tags
101
  def interrogate(self, image: Image) -> Tuple[Dict[str, float], Dict[str, float]]:
102
 
103
- imgByteArr = io.BytesIO()
104
- image.save(imgByteArr, format="png")
105
- imgByteArr = imgByteArr.getvalue()
106
- if imgByteArr in self.cache:
107
- return self.cache[imgByteArr]
108
 
109
  full_tags = self._calculation(image)
110
 
@@ -113,10 +107,6 @@ class WaifuDiffusionInterrogator:
113
 
114
  # rest are regular tags
115
  tags = dict(full_tags[full_tags['category'] != 9][['name', 'confidence']].values)
116
- self.cache[imgByteArr] = (ratings, tags)
117
- if len(self.cache) > 25:
118
- k = next(iter(self.cache))
119
- v = self.cache.pop(k)
120
 
121
  return ratings, tags
122
 
 
51
 
52
  self.__initialized = False
53
  self._model, self._tags = None, None
 
54
  def _init(self) -> None:
55
  if self.__initialized:
56
  return
 
99
  return full_tags
100
  def interrogate(self, image: Image) -> Tuple[Dict[str, float], Dict[str, float]]:
101
 
 
 
 
 
 
102
 
103
  full_tags = self._calculation(image)
104
 
 
107
 
108
  # rest are regular tags
109
  tags = dict(full_tags[full_tags['category'] != 9][['name', 'confidence']].values)
 
 
 
 
110
 
111
  return ratings, tags
112