Spaces:
Sleeping
Sleeping
title: SentimentAi | |
emoji: 💻 | |
colorFrom: gray | |
colorTo: indigo | |
sdk: streamlit | |
sdk_version: 1.36.0 | |
app_file: app.py | |
pinned: false | |
license: mit | |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |
https://launchdarkly.com/blog/build-sentiment-analysis-app-hugging-face-spaces-with-ai-model-feature-flags/ | |
## Run on docker | |
### UI | |
docker run -it -p 8501:8501 --platform=linux/amd64 \ | |
-e LAUNCHDARKLY_SDK_KEY="<LAUNCHDARKLY_SDK_KEY>" \ | |
registry.hf.space/asgface-sentimentai:latest streamlit run app.py | |
### API - WIP | |
Build your Docker image | |
```bash | |
docker build -t myapi . | |
``` | |
Run your Docker container, mapping port 5001 of the container to port 5001 on your host | |
```bash | |
docker run -p 5001:5001 -e LAUNCHDARKLY_SDK_KEY="<LAUNCHDARKLY_SDK_KEY>" myapi | |
``` | |
## Run locally | |
### API | |
python3 -m venv myenv | |
source myenv/bin/activate | |
LAUNCHDARKLY_SDK_KEY=$LAUNCHDARKLY_SDK_KEY gunicorn -w 4 -b 0.0.0.0:5001 api:app | |
# Build your Docker image | |
docker build -t morsisdivine/sentiment . | |
# Run your Docker container, mapping port 5001 of the container to port 5001 on your host | |
docker run -p 5001:5001 -e LAUNCHDARKLY_SDK_KEY=$LAUNCHDARKLY_SDK_KEY morsisdivine/sentiment | |
### UI | |
python3 -m venv myenv | |
source myenv/bin/activate | |
pip3 install -r requirements.txt | |
LAUNCHDARKLY_SDK_KEY=$LAUNCHDARKLY_SDK_KEY streamlit run app.py | |
## Run test with pytest and playwright | |
```bash | |
pytest --html=report.html --browser webkit --tracing on | |
``` |