Spaces:
Sleeping
Sleeping
Alejadro Sanchez-Giraldo
commited on
Commit
·
abfb3b0
1
Parent(s):
12dc1b0
API option
Browse files- .gitignore +4 -1
- README.md +21 -5
- api.py +1 -1
- requirements.txt +2 -1
.gitignore
CHANGED
@@ -1,2 +1,5 @@
|
|
1 |
myenv/
|
2 |
-
.DS_Store
|
|
|
|
|
|
|
|
1 |
myenv/
|
2 |
+
.DS_Store
|
3 |
+
.env
|
4 |
+
|
5 |
+
__pycache__/
|
README.md
CHANGED
@@ -12,18 +12,34 @@ license: mit
|
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
14 |
|
15 |
-
|
16 |
|
17 |
## Run on docker
|
18 |
|
19 |
### UI
|
20 |
|
21 |
docker run -it -p 8501:8501 --platform=linux/amd64 \
|
22 |
-
|
23 |
-
|
24 |
|
25 |
### API
|
26 |
|
27 |
docker run -it -p 5001:5000 --platform=linux/amd64 \
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
14 |
|
15 |
+
https://launchdarkly.com/blog/build-sentiment-analysis-app-hugging-face-spaces-with-ai-model-feature-flags/
|
16 |
|
17 |
## Run on docker
|
18 |
|
19 |
### UI
|
20 |
|
21 |
docker run -it -p 8501:8501 --platform=linux/amd64 \
|
22 |
+
-e LAUNCHDARKLY_SDK_KEY="<LAUNCHDARKLY_SDK_KEY>" \
|
23 |
+
registry.hf.space/asgface-sentimentai:latest streamlit run app.py
|
24 |
|
25 |
### API
|
26 |
|
27 |
docker run -it -p 5001:5000 --platform=linux/amd64 \
|
28 |
+
-e LAUNCHDARKLY_SDK_KEY="<LAUNCHDARKLY_SDK_KEY>" \
|
29 |
+
registry.hf.space/asgface-sentimentai:latest python api.py
|
30 |
+
|
31 |
+
## Run locally
|
32 |
+
|
33 |
+
### API
|
34 |
+
|
35 |
+
python3 -m venv myenv
|
36 |
+
source myenv/bin/activate
|
37 |
+
|
38 |
+
LAUNCHDARKLY_SDK_KEY=<LAUNCHDARKLY_SDK_KEY> gunicorn -w 4 -b 0.0.0.0:5001 api:app
|
39 |
+
|
40 |
+
### UI
|
41 |
+
|
42 |
+
python3 -m venv myenv
|
43 |
+
source myenv/bin/activate
|
44 |
+
|
45 |
+
LAUNCHDARKLY_SDK_KEY=<LAUNCHDARKLY_SDK_KEY> streamlit run app.py
|
api.py
CHANGED
@@ -64,4 +64,4 @@ def analyze_sentiment():
|
|
64 |
|
65 |
|
66 |
if __name__ == '__main__':
|
67 |
-
app.run(
|
|
|
64 |
|
65 |
|
66 |
if __name__ == '__main__':
|
67 |
+
app.run(port=5001)
|
requirements.txt
CHANGED
@@ -3,4 +3,5 @@ transformers
|
|
3 |
launchdarkly-server-sdk
|
4 |
torch
|
5 |
Flask
|
6 |
-
datasets
|
|
|
|
3 |
launchdarkly-server-sdk
|
4 |
torch
|
5 |
Flask
|
6 |
+
datasets
|
7 |
+
gunicorn
|