Spaces:
Running
Running
chore: update something
Browse files
lightweight_embeddings/__init__.py
CHANGED
@@ -63,21 +63,17 @@ EMBEDDINGS_API_URL = "http://localhost:7860/v1/embeddings"
|
|
63 |
APP_DESCRIPTION = f"""
|
64 |
# π **Lightweight Embeddings API**
|
65 |
|
66 |
-
The **Lightweight Embeddings API** is a fast, free, and multilingual service designed for generating embeddings and reranking with support for both **text** and **image** inputs.
|
67 |
|
68 |
-
### β¨
|
69 |
|
70 |
-
- **Free
|
71 |
-
- **Advanced
|
72 |
-
- **
|
73 |
-
- **Production-Ready
|
|
|
74 |
|
75 |
-
###
|
76 |
-
|
77 |
-
- **Minimal Data Collection**: This API respects your privacy by design. It does not store or log any input data (text or images) provided by users. Only anonymous usage counts (IDs for statistical purposes) are recorded to monitor and improve the service.
|
78 |
-
- **Open Source and Transparent**: The API is fully open source, ensuring transparency and allowing users to inspect the code for themselves. This guarantees trust and confidence in how the service handles your data.
|
79 |
-
|
80 |
-
### π Links
|
81 |
- [Documentation]({__metadata__["docs"]}) | [GitHub]({__metadata__["github"]}) | [Playground]({__metadata__["spaces"]})
|
82 |
"""
|
83 |
|
|
|
63 |
APP_DESCRIPTION = f"""
|
64 |
# π **Lightweight Embeddings API**
|
65 |
|
66 |
+
The **Lightweight Embeddings API** is a fast, free, and multilingual service designed for generating embeddings and reranking with support for both **text** and **image** inputs.
|
67 |
|
68 |
+
### β¨ Features & Privacy
|
69 |
|
70 |
+
- **Free & Multilingual**: Unlimited API service supporting 100+ languages with no usage restrictions
|
71 |
+
- **Advanced Processing**: High-quality text and image-text embeddings using state-of-the-art models with reranking capabilities
|
72 |
+
- **Privacy-First**: No storage of input data (text/images), only anonymous usage statistics for service improvement
|
73 |
+
- **Production-Ready**: Docker deployment, interactive Gradio playground, and comprehensive REST API documentation
|
74 |
+
- **Open & Efficient**: Fully open-source codebase using lightweight transformer models for rapid inference
|
75 |
|
76 |
+
### π Resources
|
|
|
|
|
|
|
|
|
|
|
77 |
- [Documentation]({__metadata__["docs"]}) | [GitHub]({__metadata__["github"]}) | [Playground]({__metadata__["spaces"]})
|
78 |
"""
|
79 |
|
lightweight_embeddings/router.py
CHANGED
@@ -171,8 +171,6 @@ async def create_embeddings(
|
|
171 |
input_data=request.input, modality=mkind.value
|
172 |
)
|
173 |
|
174 |
-
background_tasks.add_task(analytics.access, request.model)
|
175 |
-
|
176 |
# 4) Estimate tokens for text only
|
177 |
total_tokens = 0
|
178 |
if mkind == ModelKind.TEXT:
|
@@ -188,6 +186,10 @@ async def create_embeddings(
|
|
188 |
},
|
189 |
}
|
190 |
|
|
|
|
|
|
|
|
|
191 |
for idx, emb in enumerate(embeddings):
|
192 |
resp["data"].append(
|
193 |
{
|
@@ -227,7 +229,9 @@ async def rank_candidates(request: RankRequest, background_tasks: BackgroundTask
|
|
227 |
modality=mkind.value,
|
228 |
)
|
229 |
|
230 |
-
background_tasks.add_task(
|
|
|
|
|
231 |
|
232 |
return results
|
233 |
|
|
|
171 |
input_data=request.input, modality=mkind.value
|
172 |
)
|
173 |
|
|
|
|
|
174 |
# 4) Estimate tokens for text only
|
175 |
total_tokens = 0
|
176 |
if mkind == ModelKind.TEXT:
|
|
|
186 |
},
|
187 |
}
|
188 |
|
189 |
+
background_tasks.add_task(
|
190 |
+
analytics.access, request.model, resp["usage"]["total_tokens"]
|
191 |
+
)
|
192 |
+
|
193 |
for idx, emb in enumerate(embeddings):
|
194 |
resp["data"].append(
|
195 |
{
|
|
|
229 |
modality=mkind.value,
|
230 |
)
|
231 |
|
232 |
+
background_tasks.add_task(
|
233 |
+
analytics.access, request.model, results["usage"]["total_tokens"]
|
234 |
+
)
|
235 |
|
236 |
return results
|
237 |
|