Search anything.
For a tutorial on how this service works, see the Deploy Whisper and Sentence Transformer Model to HuggingFace notebook or open it in a Colab:
TODO: Getting weird import errors when trying to import sibling directories.
pipenv run python src/app.py
ModuleNotFoundError: No module named 'atlas'
Temporary workaround: use sls wsgi serve --config serverless.dev.yml
.
cp serverless.yml serverless.dev.yml
- Set the following environment variables:
environment:
HUGGING_FACE_URL: ""
HUGGING_FACE_API_KEY: ""
PINECONE_API_KEY: ""
sls wsgi serve --config serverless.dev.yml
Make sure to put the credentials in serverless.dev.yml and notserverless.yml
pip install pipenv
pipenv install
pipenv run python src/app.py
If pipenv
doesn't work, try
prefixing all your commands with python -m pipenv
python -m pipenv install
python -m pipenv run python src/app.py
To simulate how the lambda sevice will run locally:
sls wsgi serve
To set the environment variables in gitpod, edit the following and paste into your terminal.
eval $(gp env -e HUGGING_FACE_URL=your_value)
eval $(gp env -e HUGGING_FACE_API_KEY=your_value)
eval $(gp env -e PINECONE_API_KEY=your_value)
You can test as a GET request by putting setting the ?url=<url>
and &q=<search term>
Since your url might be different you can just copy-paste the following and append it to your API URL.
/search?q=neural%20network&url=https://youtu.be/lOI0Gs_t6cQ
To search all videos
/search?q=throw under the bus
You can also send POST requests.
curl --location --request POST 'http://127.0.0.1:5000/search' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://www.youtube.com/watch?v=ciKdF97JWpU",
"q": "throw under bus"
}'
Remove the URL property to search all videos
curl --location --request POST 'http://127.0.0.1:5000/search' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://www.youtube.com/watch?v=ciKdF97JWpU",
"q": "throw under bus"
}'
- The service is deployed as an AWS Lambda function
- View Function logs in Cloudwatch