docs: update README with API and deployment guide
This commit is contained in:
parent
a71c52a69d
commit
ee63e7194c
64
README.md
64
README.md
@ -1,52 +1,42 @@
|
||||
# CLIP Embedding Service
|
||||
# CLIP Embedding — 多模态向量化服务
|
||||
|
||||
CLIP-ViT-H/14 多模态 Embedding 服务,支持文本和图片向量化。
|
||||
## 概述
|
||||
|
||||
## Overview
|
||||
基于 OpenAI CLIP ViT-H-14 的多模态嵌入服务,将文本和图像编码为统一的 1024 维向量空间,实现图文跨模态检索。
|
||||
|
||||
- **Model**: laion/CLIP-ViT-H-14-laion2B-s32B-b79K
|
||||
- **Dimension**: 1024
|
||||
- **Precision**: float16
|
||||
- **Port**: 9086
|
||||
- **GPU**: 2 (default)
|
||||
## 模型
|
||||
|
||||
- BAAI/CLIP-ViT-H-14 (OpenCLIP)
|
||||
- 向量维度: 1024
|
||||
- GPU: 部署于 GPU 服务器
|
||||
|
||||
## API
|
||||
|
||||
### GET /api/status
|
||||
Service health and GPU info.
|
||||
| 端点 | 方法 | 说明 |
|
||||
|------|------|------|
|
||||
| /api/status | GET | 服务状态和模型信息 |
|
||||
| /api/text | POST | 文本 → 向量 |
|
||||
| /api/image | POST | 图片 → 向量 |
|
||||
| /api/similarity | POST | 文本-图片相似度计算 |
|
||||
|
||||
## 请求示例
|
||||
|
||||
### POST /api/text
|
||||
Text embedding.
|
||||
```json
|
||||
{"texts": ["hello world", "a cat"]}
|
||||
POST /api/text
|
||||
{"texts": ["一只猫坐在沙发上", "日落海滩"]}
|
||||
|
||||
POST /api/image
|
||||
{"images": ["base64图片数据"]}
|
||||
```
|
||||
|
||||
### POST /api/image
|
||||
Image embedding (file path, URL, or base64 data URI).
|
||||
```json
|
||||
{"images": ["/path/to/img.jpg", "https://example.com/img.png"]}
|
||||
```
|
||||
|
||||
### POST /api/embed
|
||||
Combined text + image embedding.
|
||||
```json
|
||||
{"texts": ["a cat"], "images": ["/path/to/cat.jpg"]}
|
||||
```
|
||||
|
||||
## Model Download (Offline Deploy)
|
||||
## 部署
|
||||
|
||||
```bash
|
||||
pip install huggingface_hub
|
||||
huggingface-cli download laion/CLIP-ViT-H-14-laion2B-s32B-b79K \
|
||||
--local-dir /data/ymq/models/laion/CLIP-ViT-H-14-laion2B-s32B-b79K \
|
||||
--local-dir-use-symlinks False
|
||||
cd /data/ymq/clip_embedding
|
||||
bash build.sh
|
||||
sudo systemctl restart clip
|
||||
```
|
||||
Size: ~15GB
|
||||
|
||||
## Deploy
|
||||
## 端口
|
||||
|
||||
```bash
|
||||
bash build.sh deploy # start
|
||||
bash build.sh stop # stop
|
||||
bash build.sh status # check
|
||||
```
|
||||
9086
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user