saskarkhadka commited on
Commit
726cc73
·
1 Parent(s): 828de3d

migrate backend to huggingface spaces

Browse files
.dockerignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ parameters.json
2
+ train_history.pkl
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.json filter=lfs diff=lfs merge=lfs -text
37
+ *.keras filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .venv
2
+ __pycache__
3
+ .env
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /usr/src/app
4
+
5
+ COPY requirements.txt .
6
+
7
+ RUN python3 -m venv /.venv && \
8
+ /.venv/bin/pip3 install --upgrade pip && \
9
+ /.venv/bin/pip3 install -r requirements.txt && \
10
+ /.venv/bin/pip3 cache purge && \
11
+ mkdir /outputs && mkdir /outputs/bert && \
12
+ mkdir /outputs/ml && mkdir /outputs/mlp && \
13
+ mkdir /outputs/lstm
14
+
15
+ COPY outputs/bert/label_encoder.pkl ./outputs/bert
16
+ COPY outputs/lstm ./outputs/lstm
17
+ COPY outputs/ml ./outputs/ml
18
+ COPY outputs/mlp ./outputs/mlp
19
+
20
+ COPY app ./app
21
+
22
+ EXPOSE 8000
23
+
24
+ RUN useradd -m appuser
25
+
26
+ COPY start.sh .
27
+
28
+ RUN chmod +x start.sh
29
+
30
+ USER appuser
31
+
32
+ CMD ["./start.sh"]
outputs/.DS_Store ADDED
Binary file (6.15 kB). View file
 
outputs/bert/.DS_Store ADDED
Binary file (6.15 kB). View file
 
outputs/bert/label_encoder.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00a81aa579b3938c67a0871b6592786ad8e7a2f746ca8e575d3ae03ee67bdca4
3
+ size 466
outputs/lstm/LSTM_nepali_news_classifier_model.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a64b13353cf6a3f14ec6a63bdccaa8b52da6a96eb0d9369e961d2969b621aa5
3
+ size 31286227
outputs/lstm/label_encoder.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a900f4fb20632b47e810552d14aed2bd18f939e07ffec486300e58f12efe923
3
+ size 467
outputs/lstm/parameters.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3985b34255cc958610d292d7f470174ae9cde2b70e6b3fdd561bcaf540d7549a
3
+ size 188
outputs/lstm/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19dad993161bd7c2aa9e81152c62bb36f8f6d73fd079ca4fc0de1e6e6621b030
3
+ size 299289197
outputs/lstm/train_history.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c048fafb18756bc97d81cf38a6293fe5bd71ac47c10d081926c8bf001aad85b7
3
+ size 2208
outputs/ml/Gradient_Boosting_Classifier.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f5abbe4d21006880351d15c7f8dc8c4fa7d2a93b4f1a65b8fb08df956878ffc
3
+ size 1050024
outputs/ml/Gradient_Boosting_Classifier_Classification_Report.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f8af7553669454195ac2bea58de6031439a2e002951f686a403ed7a89fbd0ff
3
+ size 668
outputs/ml/Naive_Bayes_Classifier.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c9e2cae63878cde331aefa145a5025b320972aa5a774d08cdfd7635f7149396
3
+ size 6656935
outputs/ml/Naive_Bayes_Classifier_Classification_Report.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16eef840b26fb0571bbf5944a3c1cf94fb0866c062dec66102e1408d3918d3e4
3
+ size 668
outputs/ml/XG_Boost_Classifier.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ba84fdf5fca68be74fedc379836342bdcaf57c5679c8d681fd088fa2e59ddcd
3
+ size 2697274
outputs/ml/XG_Boost_Classifier_Classification_Report.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42b72770604df821796c863ef626382e6deda928eba79ccdf6bf25cb8a188f27
3
+ size 668
outputs/ml/label_encoder.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a900f4fb20632b47e810552d14aed2bd18f939e07ffec486300e58f12efe923
3
+ size 467
outputs/ml/parameters.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ddf7448ff24e648529ad9629cadc0296f4793c753f9edae33e28fe72fc95464
3
+ size 47
outputs/ml/tfidf_vectorizer.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6073d97fb39ffb3bda13f0fd9b63dd63230eb48cdfe663c78a097de0765a9b46
3
+ size 2289879
outputs/mlp/MLP_nepali_news_classifier_model.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ce67e3cb8b0745f8c35a87c6b04c27b37b71b9dc1817b4457d507641130b28d
3
+ size 31256027
outputs/mlp/label_encoder.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a900f4fb20632b47e810552d14aed2bd18f939e07ffec486300e58f12efe923
3
+ size 467
outputs/mlp/parameters.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e19f8b1285b837029f5f696b2bef3e8a512e6793d8f883b53c6a35a94a191c33
3
+ size 189
outputs/mlp/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a45f316d0455292f6353a44ff4a86b7b68f88002744264a3573ec63af44ba04d
3
+ size 299231122
outputs/mlp/train_history.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acb797a3a0ebe9d85dc5a0cb3a34a2ce6864864c6b7c6335cd73f01aef0f0f34
3
+ size 2424
requirements.txt ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==2.2.2
2
+ accelerate==1.6.0
3
+ altair==5.5.0
4
+ annotated-types==0.7.0
5
+ anyio==4.9.0
6
+ appnope==0.1.4
7
+ asttokens==3.0.0
8
+ astunparse==1.6.3
9
+ attrs==25.3.0
10
+ blinker==1.9.0
11
+ cachetools==5.5.2
12
+ certifi==2025.4.26
13
+ charset-normalizer==3.4.2
14
+ click==8.1.8
15
+ comm==0.2.2
16
+ contourpy==1.3.2
17
+ cycler==0.12.1
18
+ debugpy==1.8.14
19
+ decorator==5.2.1
20
+ dnspython==2.7.0
21
+ email_validator==2.2.0
22
+ executing==2.2.0
23
+ fastapi==0.115.14
24
+ fastapi-cli==0.0.7
25
+ filelock==3.18.0
26
+ flatbuffers==25.2.10
27
+ fonttools==4.57.0
28
+ fsspec==2025.3.2
29
+ gast==0.6.0
30
+ gitdb==4.0.12
31
+ GitPython==3.1.44
32
+ google-pasta==0.2.0
33
+ grpcio==1.71.0
34
+ h11==0.16.0
35
+ h5py==3.13.0
36
+ httpcore==1.0.9
37
+ httptools==0.6.4
38
+ httpx==0.28.1
39
+ huggingface-hub==0.30.2
40
+ idna==3.10
41
+ ipykernel==6.29.5
42
+ ipython==9.2.0
43
+ ipython_pygments_lexers==1.1.1
44
+ jedi==0.19.2
45
+ Jinja2==3.1.6
46
+ joblib==1.5.0
47
+ jsonschema==4.23.0
48
+ jsonschema-specifications==2025.4.1
49
+ jupyter_client==8.6.3
50
+ jupyter_core==5.7.2
51
+ keras==3.9.2
52
+ kiwisolver==1.4.8
53
+ libclang==18.1.1
54
+ Markdown==3.8
55
+ markdown-it-py==3.0.0
56
+ MarkupSafe==3.0.2
57
+ matplotlib==3.10.3
58
+ matplotlib-inline==0.1.7
59
+ mdurl==0.1.2
60
+ ml_dtypes==0.5.1
61
+ mpmath==1.3.0
62
+ namex==0.0.9
63
+ narwhals==1.38.0
64
+ nest-asyncio==1.6.0
65
+ networkx==3.4.2
66
+ nltk==3.9.1
67
+ numpy==2.1.3
68
+ opt_einsum==3.4.0
69
+ optree==0.15.0
70
+ packaging==24.2
71
+ pandas==2.2.3
72
+ parso==0.8.4
73
+ pexpect==4.9.0
74
+ pillow==11.2.1
75
+ platformdirs==4.3.7
76
+ prompt_toolkit==3.0.51
77
+ protobuf==5.29.5
78
+ psutil==7.0.0
79
+ ptyprocess==0.7.0
80
+ pure_eval==0.2.3
81
+ pyarrow==20.0.0
82
+ pydantic==2.11.7
83
+ pydantic_core==2.33.2
84
+ pydeck==0.9.1
85
+ pydot==4.0.0
86
+ Pygments==2.19.1
87
+ pyparsing==3.2.3
88
+ python-dateutil==2.9.0.post0
89
+ python-dotenv==1.1.1
90
+ python-multipart==0.0.20
91
+ pytz==2025.2
92
+ PyYAML==6.0.2
93
+ pyzmq==26.4.0
94
+ referencing==0.36.2
95
+ regex==2024.11.6
96
+ requests==2.32.4
97
+ rich==14.0.0
98
+ rich-toolkit==0.14.7
99
+ rpds-py==0.24.0
100
+ safetensors==0.5.3
101
+ scikit-learn==1.6.1
102
+ scipy==1.15.2
103
+ seaborn==0.13.2
104
+ shellingham==1.5.4
105
+ six==1.17.0
106
+ smmap==5.0.2
107
+ sniffio==1.3.1
108
+ stack-data==0.6.3
109
+ starlette==0.46.2
110
+ streamlit==1.45.0
111
+ sympy==1.14.0
112
+ tenacity==9.1.2
113
+ tensorboard==2.19.0
114
+ tensorboard-data-server==0.7.2
115
+ tensorflow==2.19.0
116
+ tensorflow-io-gcs-filesystem==0.37.1
117
+ termcolor==3.1.0
118
+ threadpoolctl==3.6.0
119
+ tokenizers==0.21.1
120
+ toml==0.10.2
121
+ torch==2.7.1
122
+ tornado==6.5.1
123
+ tqdm==4.67.1
124
+ traitlets==5.14.3
125
+ transformers==4.51.3
126
+ typer==0.16.0
127
+ typing-inspection==0.4.1
128
+ typing_extensions==4.13.2
129
+ tzdata==2025.2
130
+ urllib3==2.5.0
131
+ uvicorn==0.34.3
132
+ uvloop==0.21.0
133
+ watchfiles==1.1.0
134
+ wcwidth==0.2.13
135
+ websockets==15.0.1
136
+ Werkzeug==3.1.3
137
+ wrapt==1.17.2
138
+ xgboost==3.0.0
start.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ source .venv/bin/activate
4
+ export PYTHONPATH=$PWD
5
+ # export PORT=${PORT:-8000}
6
+ python app/preprocess/download_nltk_stopwords.py
7
+ # uvicorn app.main:app --host 0.0.0.0 --port $PORT
8
+ python app/main.py