kardosdrur commited on
Commit
4fefa96
·
1 Parent(s): 333f5c4

Added deployment

Browse files
Files changed (3) hide show
  1. Dockerfile +34 -0
  2. main.py +11 -0
  3. topic_data.joblib +3 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim-bullseye
2
+
3
+ RUN apt update
4
+ RUN apt install -y build-essential
5
+
6
+ RUN pip install gunicorn==20.1.0
7
+ RUN pip install typing-extensions
8
+ RUN pip install scikit-learn==1.3.2
9
+ RUN pip install topic-wizard==1.1.0
10
+ RUN pip install joblib==1.2.0
11
+ RUN pip install turftopic==0.4.5
12
+ RUN pip install gensim==4.3.2
13
+
14
+ RUN useradd -m -u 1000 user
15
+
16
+ # Switch to the "user" user
17
+ USER user
18
+
19
+ # Set home to the user's home directory
20
+ ENV HOME=/home/user \
21
+ PATH=/home/user/.local/bin:$PATH
22
+
23
+ COPY --chown=user . $HOME/app
24
+
25
+
26
+ RUN mkdir /home/user/numba_cache
27
+ RUN chmod 777 /home/user/numba_cache
28
+
29
+ ENV NUMBA_CACHE_DIR=/home/user/numba_cache
30
+
31
+ # Set the working directory to the user's home directory
32
+ WORKDIR $HOME/app
33
+ EXPOSE 7860
34
+ CMD gunicorn --timeout 0 -b 0.0.0.0:7860 --workers=2 --threads=4 --worker-class=gthread main:server
main.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import joblib
3
+ import topicwizard
4
+
5
+ topic_data = joblib.load("topic_data.joblib")
6
+
7
+ app = topicwizard.get_dash_app(topic_data)
8
+ server = app.server
9
+
10
+ if __name__ == "__main__":
11
+ app.run_server(debug=False, port=7860)
topic_data.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19264fc988a97e010b1527dc16b1495d8ea46dbf8283d4ea81aa66c452ad7577
3
+ size 397923245