Spaces:
Running
Running
fix: resolved related issues count and rank
Browse files
lightweight_embeddings/analytics.py
CHANGED
|
@@ -154,7 +154,7 @@ class Analytics:
|
|
| 154 |
None, partial(self.redis_client.hgetall, key)
|
| 155 |
)
|
| 156 |
for model_id, count_str in data.items():
|
| 157 |
-
self.local_buffer["access"][period][model_id]
|
| 158 |
|
| 159 |
if cursor == 0:
|
| 160 |
break
|
|
@@ -180,7 +180,7 @@ class Analytics:
|
|
| 180 |
None, partial(self.redis_client.hgetall, key)
|
| 181 |
)
|
| 182 |
for model_id, count_str in data.items():
|
| 183 |
-
self.local_buffer["tokens"][period][model_id]
|
| 184 |
|
| 185 |
if cursor == 0:
|
| 186 |
break
|
|
|
|
| 154 |
None, partial(self.redis_client.hgetall, key)
|
| 155 |
)
|
| 156 |
for model_id, count_str in data.items():
|
| 157 |
+
self.local_buffer["access"][period][model_id] = int(count_str)
|
| 158 |
|
| 159 |
if cursor == 0:
|
| 160 |
break
|
|
|
|
| 180 |
None, partial(self.redis_client.hgetall, key)
|
| 181 |
)
|
| 182 |
for model_id, count_str in data.items():
|
| 183 |
+
self.local_buffer["tokens"][period][model_id] = int(count_str)
|
| 184 |
|
| 185 |
if cursor == 0:
|
| 186 |
break
|
lightweight_embeddings/service.py
CHANGED
|
@@ -282,7 +282,7 @@ class EmbeddingsService:
|
|
| 282 |
try:
|
| 283 |
if len(texts) == 1:
|
| 284 |
single_text = texts[0]
|
| 285 |
-
key = md5(single_text.encode("utf-8")).hexdigest()
|
| 286 |
if key in self.lru_cache:
|
| 287 |
return self.lru_cache[key]
|
| 288 |
|
|
|
|
| 282 |
try:
|
| 283 |
if len(texts) == 1:
|
| 284 |
single_text = texts[0]
|
| 285 |
+
key = md5(f"{model_id}:{single_text}".encode("utf-8")).hexdigest()[:8]
|
| 286 |
if key in self.lru_cache:
|
| 287 |
return self.lru_cache[key]
|
| 288 |
|