Spaces:
Runtime error
Runtime error
Commit
·
c4968c3
1
Parent(s):
ed9ad5e
dockerize
Browse files- Dockerfile +18 -0
- app.py +8 -2
Dockerfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# Use an official Python runtime as a parent image
|
| 3 |
+
FROM arslan2k12/ttyd_base
|
| 4 |
+
|
| 5 |
+
# Set the working directory in the container
|
| 6 |
+
WORKDIR /app/ttyd
|
| 7 |
+
|
| 8 |
+
# Copy the current directory contents into the container at /usr/src/app
|
| 9 |
+
COPY . /app/ttyd
|
| 10 |
+
|
| 11 |
+
# to make gradio app accessible to local network (default 127.0.0.1 is only accissible within the container)
|
| 12 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 13 |
+
|
| 14 |
+
# Install any needed packages specified in requirements.txt
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Use ENTRYPOINT to allow passing user arguments
|
| 18 |
+
ENTRYPOINT ["python", "app.py"]
|
app.py
CHANGED
|
@@ -28,8 +28,14 @@ from ttyd_consts import *
|
|
| 28 |
###############################################################################################
|
| 29 |
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
if mode.type!='userInputDocs':
|
| 35 |
# local vector store as opposed to gradio state vector store
|
|
|
|
| 28 |
###############################################################################################
|
| 29 |
|
| 30 |
|
| 31 |
+
# select the mode at runtime while starting container - modes options are in ttyd_consts.py
|
| 32 |
+
if os.getenv("TTYD_MODE")=='arslan':
|
| 33 |
+
mode = mode_arslan
|
| 34 |
+
elif os.getenv("TTYD_MODE")=='nustian':
|
| 35 |
+
mode = mode_nustian
|
| 36 |
+
else:
|
| 37 |
+
mode = mode_general
|
| 38 |
+
|
| 39 |
|
| 40 |
if mode.type!='userInputDocs':
|
| 41 |
# local vector store as opposed to gradio state vector store
|