Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -103,8 +103,8 @@ class WaifuDiffusionInterrogator:
|
|
103 |
imgByteArr = io.BytesIO()
|
104 |
image.save(imgByteArr, format="png")
|
105 |
imgByteArr = imgByteArr.getvalue()
|
106 |
-
if imgByteArr in cache:
|
107 |
-
return cache[imgByteArr]
|
108 |
|
109 |
full_tags = self._calculation(image)
|
110 |
|
@@ -114,8 +114,8 @@ class WaifuDiffusionInterrogator:
|
|
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(cache) > 25:
|
118 |
-
cache.popitem(last=False)
|
119 |
|
120 |
return ratings, tags
|
121 |
|
|
|
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 |
|
|
|
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 |
+
self.cache.popitem(last=False)
|
119 |
|
120 |
return ratings, tags
|
121 |
|