Spaces:
Sleeping
Sleeping
Configure space for deployment
Browse files- Dockerfile +14 -0
- README.md +69 -5
- requirements.txt +1 -0
Dockerfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM michaelf34/infinity:latest-cpu
|
| 2 |
+
|
| 3 |
+
ENV INFINITY_ANONYMOUS_USAGE_STATS=0 \
|
| 4 |
+
INFINITY_MODEL_ID="jinaai/jina-embeddings-v5-text-small;jinaai/jina-reranker-v3;clapAI/modernBERT-base-multilingual-sentiment" \
|
| 5 |
+
INFINITY_SERVED_MODEL_NAME="multilingual-embed;multilingual-rerank;multilingual-classify" \
|
| 6 |
+
INFINITY_ENGINE="torch" \
|
| 7 |
+
INFINITY_DEVICE="cpu" \
|
| 8 |
+
INFINITY_PORT="7860" \
|
| 9 |
+
INFINITY_BATCH_SIZE="4;1;8"
|
| 10 |
+
|
| 11 |
+
EXPOSE 7860
|
| 12 |
+
|
| 13 |
+
ENTRYPOINT ["bash", "-lc"]
|
| 14 |
+
CMD ["infinity_emb v2"]
|
README.md
CHANGED
|
@@ -1,10 +1,74 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
colorFrom: gray
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
-
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: multilingual-nlp
|
| 3 |
+
colorFrom: indigo
|
|
|
|
| 4 |
colorTo: blue
|
| 5 |
sdk: docker
|
| 6 |
+
app_port: 7860
|
| 7 |
+
pinned: true
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# multilingual-nlp
|
| 11 |
+
|
| 12 |
+
Multilingual embedding, reranking, and classification service running on Infinity and targeted at `cpu-basic`.
|
| 13 |
+
|
| 14 |
+
## Model Set
|
| 15 |
+
|
| 16 |
+
- Embeddings: `jinaai/jina-embeddings-v5-text-small`
|
| 17 |
+
- Reranker: `jinaai/jina-reranker-v3`
|
| 18 |
+
- Classifier: `clapAI/modernBERT-base-multilingual-sentiment`
|
| 19 |
+
|
| 20 |
+
The requested `tasksource/ModernBERT-base-nli` is an NLI / zero-shot model, not a direct sequence-classification checkpoint for the Infinity `/classify` contract, so it was replaced with a real multilingual classifier.
|
| 21 |
+
|
| 22 |
+
## Endpoints
|
| 23 |
+
|
| 24 |
+
- `GET /health`
|
| 25 |
+
- `GET /models`
|
| 26 |
+
- `POST /embeddings`
|
| 27 |
+
- `POST /rerank`
|
| 28 |
+
- `POST /classify`
|
| 29 |
+
- `GET /openapi.json`
|
| 30 |
+
|
| 31 |
+
## Example Requests
|
| 32 |
+
|
| 33 |
+
### Embeddings
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
curl -X POST "$SPACE_URL/embeddings" \
|
| 37 |
+
-H "Content-Type: application/json" \
|
| 38 |
+
-d '{
|
| 39 |
+
"model": "multilingual-embed",
|
| 40 |
+
"input": ["A beautiful sunset over the beach"]
|
| 41 |
+
}'
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
### Reranking
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
curl -X POST "$SPACE_URL/rerank" \
|
| 48 |
+
-H "Content-Type: application/json" \
|
| 49 |
+
-d '{
|
| 50 |
+
"model": "multilingual-rerank",
|
| 51 |
+
"query": "best way to reset an account password",
|
| 52 |
+
"documents": [
|
| 53 |
+
"Use the password reset form and confirm the email link.",
|
| 54 |
+
"Green tea contains antioxidants."
|
| 55 |
+
],
|
| 56 |
+
"return_documents": true
|
| 57 |
+
}'
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
### Classification
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
curl -X POST "$SPACE_URL/classify" \
|
| 64 |
+
-H "Content-Type: application/json" \
|
| 65 |
+
-d '{
|
| 66 |
+
"model": "multilingual-classify",
|
| 67 |
+
"input": ["This support experience was disappointing."]
|
| 68 |
+
}'
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Notes
|
| 72 |
+
|
| 73 |
+
- This Space keeps the same Infinity-style API contract as the source service.
|
| 74 |
+
- The embedding and reranking models are under `CC BY-NC 4.0`; verify that license for your use case.
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Docker Space. Dependencies are provided by the container image.
|