File size: 1,491 Bytes
79d4e08
 
 
 
 
 
 
 
 
 
 
 
 
0a21b81
abfb3b0
0a21b81
 
 
0c868d2
 
 
abfb3b0
 
0c868d2
d79de33
0c868d2
d79de33
 
 
 
 
 
 
 
 
 
 
abfb3b0
 
 
 
 
 
 
 
185801a
abfb3b0
d79de33
 
434260a
d79de33
 
 
185801a
d79de33
abfb3b0
 
 
 
8451c82
abfb3b0
185801a
7e6eae0
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
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
```