Spaces:
Runtime error
Runtime error
andrewlee1807
commited on
Commit
·
e99c10f
1
Parent(s):
f2be9d4
update
Browse files- Dockerfile +13 -36
- app.py +1 -1
Dockerfile
CHANGED
@@ -1,43 +1,20 @@
|
|
1 |
-
#
|
2 |
-
|
3 |
|
4 |
-
FROM python
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
RUN apt-get update && apt-get -y upgrade \
|
8 |
-
&& export DEBIAN_FRONTEND=noninteractive \
|
9 |
-
&& apt-get -y install --no-install-recommends curl build-essential
|
10 |
|
11 |
-
|
12 |
-
RUN useradd --create-home appuser
|
13 |
-
USER appuser
|
14 |
-
WORKDIR /home/appuser/app
|
15 |
|
16 |
-
|
17 |
-
ARG WAVE_VERSION="0.20.0"
|
18 |
|
19 |
-
ENV WAVE_HOME="/home/appuser/wave"
|
20 |
-
RUN \
|
21 |
-
mkdir -p "${WAVE_HOME}" && \
|
22 |
-
curl -fsSL https://github.com/h2oai/wave/releases/download/v${WAVE_VERSION}/wave-${WAVE_VERSION}-linux-amd64.tar.gz | tar -C ${WAVE_HOME} -xzv 2>&1
|
23 |
-
ENV WAVE_PATH="${WAVE_HOME}/wave-${WAVE_VERSION}-linux-amd64"
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
|
28 |
-
ENV
|
29 |
|
30 |
-
|
31 |
-
COPY requirements.txt .
|
32 |
-
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
33 |
-
|
34 |
-
# Copy app code
|
35 |
-
COPY --chown=appuser:appuser . .
|
36 |
-
|
37 |
-
# Set permissions for the Entrypoint script
|
38 |
-
RUN chmod +x docker-entrypoint.sh
|
39 |
-
|
40 |
-
ARG PYTHON_MODULE
|
41 |
-
ENV PYTHON_MODULE="${PYTHON_MODULE}"
|
42 |
-
|
43 |
-
ENTRYPOINT [ "./docker-entrypoint.sh" ]
|
|
|
1 |
+
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
+
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
+
FROM python:3.8
|
5 |
+
# When running on M1 Mac, use the following --platform option.
|
6 |
+
# FROM --platform=linux/amd64 python:3.9
|
7 |
|
8 |
+
WORKDIR /code
|
|
|
|
|
|
|
9 |
|
10 |
+
COPY . .
|
|
|
|
|
|
|
11 |
|
12 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
# Change the port number of our Wave app to 7860
|
16 |
+
# which is default in Hugging Face Spaces.
|
17 |
+
ENV H2O_WAVE_LISTEN=":7860"
|
18 |
+
ENV H2O_WAVE_ADDRESS='http://127.0.0.1:7860'
|
19 |
|
20 |
+
CMD ["wave", "run", "app", "--no-reload"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -75,7 +75,7 @@ def on_shutdown():
|
|
75 |
task_data = asyncio.create_task(api_get_data())
|
76 |
|
77 |
|
78 |
-
@app('/
|
79 |
async def sever(q: Q):
|
80 |
apply_layout(q)
|
81 |
show_homepage(q)
|
|
|
75 |
task_data = asyncio.create_task(api_get_data())
|
76 |
|
77 |
|
78 |
+
@app('/', on_startup=on_startup, on_shutdown=on_shutdown, mode='broadcast')
|
79 |
async def sever(q: Q):
|
80 |
apply_layout(q)
|
81 |
show_homepage(q)
|