sentence-encoder-lambda
所属分类:数值算法/人工智能
开发工具:Dockerfile
文件大小:2KB
下载次数:0
上传日期:2021-09-16 17:00:10
上 传 者:
sh-1993
说明: 语句编码器lambda,通过Dockerized lambda函数访问Tensorflow的通用语句编码器模型。
(sentence-encoder-lambda,Access Tensorflow s Universal sentence encoder model via a Dockerized Lambda function.)
文件列表:
.dockerignore (129, 2021-09-17)
Dockerfile (1387, 2021-09-17)
app.py (380, 2021-09-17)
requirements.txt (54, 2021-09-17)
## Universal Sentence Encoder Lambda
### Run locally
1. Build Docker container
```bash
docker build --tag sentence-encoder-lambda .
```
2. Run container
```bash
docker run -p 9000:8080 sentence-encoder-lambda:latest
```
3. Make a cURL request
```curl
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"text":["are you open?"]}'
```
### Result
The endpoint returns a 512 dimension dense vector, which can be used when implementing e.g. a similarity search
```json
{"vector":"[-0.01935427635908127, ....]"}
```
###
Resources
1. Tensorflow Hub - [Universal Sentence Encoder](https://tfhub.dev/google/universal-sentence-encoder/4)
2. Lambda Function Handlers - [Python](https://docs.aws.amazon.com/lambda/latest/dg/python-handler.html)
3. Testing Locally - [Lambda Containers](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html)
近期下载者:
相关文件:
收藏者: