Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gotha/text-vectorizer
https://github.com/gotha/text-vectorizer
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gotha/text-vectorizer
- Owner: gotha
- Created: 2024-08-01T05:21:26.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-18T19:22:05.000Z (5 months ago)
- Last Synced: 2024-08-19T19:15:14.584Z (5 months ago)
- Language: Rust
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Text Vectorizer
Text Vectorization API using [all-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L12-v2)
## Requirements
### Rust
The recommended way to install and maintain rust toolchain is via [rustup](https://rustup.rs/)
```sh
rustup toolchain install stable
```### Dependencies
Install [libtorch](https://pytorch.org/get-started/locally/) version 2.1
```sh
cd /opt
wget https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcu118.zip
unzip libtorch-cxx11-abi-shared-with-deps-2.1.0+cu118.zip
export LIBTORCH=/opt/libtorch
export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
```## Build
```sh
cargo build
```## Run
```sh
cargo run
```## Usage
```sh
curl -v \
-X POST \
-H "Content-Type: application/json" \
-d '{"text": "Lorem ipsum"}' \
-H "Authorization: Bearer 123" \
localhost:5002/predict
```or
```sh
curl -v \
-X POST \
-d 'Lorem ipsum' \
-H "Authorization: Bearer 123" \
localhost:5002/predict
```