Spaces:
Paused
Paused
Duplicate from SpacesExamples/jupyterlab
Browse filesCo-authored-by: Nate Raw <nateraw@users.noreply.huggingface.co>
- .gitattributes +34 -0
- Dockerfile +99 -0
- README.md +12 -0
- login.html +67 -0
- on_startup.sh +5 -0
- packages.txt +1 -0
- requirements.txt +4 -0
- start_server.sh +16 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
2 |
+
|
3 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
+
TZ=Europe/Paris
|
5 |
+
|
6 |
+
# Remove any third-party apt sources to avoid issues with expiring keys.
|
7 |
+
# Install some basic utilities
|
8 |
+
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
9 |
+
apt-get update && apt-get install -y --no-install-recommends \
|
10 |
+
curl \
|
11 |
+
ca-certificates \
|
12 |
+
sudo \
|
13 |
+
git \
|
14 |
+
git-lfs \
|
15 |
+
zip \
|
16 |
+
unzip \
|
17 |
+
htop \
|
18 |
+
bzip2 \
|
19 |
+
libx11-6 \
|
20 |
+
build-essential \
|
21 |
+
libsndfile-dev \
|
22 |
+
software-properties-common \
|
23 |
+
&& rm -rf /var/lib/apt/lists/*
|
24 |
+
|
25 |
+
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
26 |
+
apt-get upgrade -y && \
|
27 |
+
apt-get install -y --no-install-recommends nvtop
|
28 |
+
|
29 |
+
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
30 |
+
apt-get install -y nodejs && \
|
31 |
+
npm install -g configurable-http-proxy
|
32 |
+
|
33 |
+
# Create a working directory
|
34 |
+
WORKDIR /app
|
35 |
+
|
36 |
+
# Create a non-root user and switch to it
|
37 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
38 |
+
&& chown -R user:user /app
|
39 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
40 |
+
USER user
|
41 |
+
|
42 |
+
# All users can use /home/user as their home directory
|
43 |
+
ENV HOME=/home/user
|
44 |
+
RUN mkdir $HOME/.cache $HOME/.config \
|
45 |
+
&& chmod -R 777 $HOME
|
46 |
+
|
47 |
+
# Set up the Conda environment
|
48 |
+
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
49 |
+
PATH=$HOME/miniconda/bin:$PATH
|
50 |
+
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
51 |
+
&& chmod +x ~/miniconda.sh \
|
52 |
+
&& ~/miniconda.sh -b -p ~/miniconda \
|
53 |
+
&& rm ~/miniconda.sh \
|
54 |
+
&& conda clean -ya
|
55 |
+
|
56 |
+
WORKDIR $HOME/app
|
57 |
+
|
58 |
+
#######################################
|
59 |
+
# Start root user section
|
60 |
+
#######################################
|
61 |
+
|
62 |
+
USER root
|
63 |
+
|
64 |
+
# User Debian packages
|
65 |
+
## Security warning : Potential user code executed as root (build time)
|
66 |
+
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
67 |
+
apt-get update && \
|
68 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
69 |
+
&& rm -rf /var/lib/apt/lists/*
|
70 |
+
|
71 |
+
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
72 |
+
bash /root/on_startup.sh
|
73 |
+
|
74 |
+
#######################################
|
75 |
+
# End root user section
|
76 |
+
#######################################
|
77 |
+
|
78 |
+
USER user
|
79 |
+
|
80 |
+
# Python packages
|
81 |
+
RUN --mount=target=requirements.txt,source=requirements.txt \
|
82 |
+
pip install --no-cache-dir --upgrade -r requirements.txt
|
83 |
+
|
84 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
85 |
+
COPY --chown=user . $HOME/app
|
86 |
+
|
87 |
+
RUN chmod +x start_server.sh
|
88 |
+
|
89 |
+
COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
90 |
+
|
91 |
+
ENV PYTHONUNBUFFERED=1 \
|
92 |
+
GRADIO_ALLOW_FLAGGING=never \
|
93 |
+
GRADIO_NUM_PORTS=1 \
|
94 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
95 |
+
GRADIO_THEME=huggingface \
|
96 |
+
SYSTEM=spaces \
|
97 |
+
SHELL=/bin/bash
|
98 |
+
|
99 |
+
CMD ["./start_server.sh"]
|
README.md
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: JupyterLab
|
3 |
+
emoji: 💻🐳
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: green
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
tags:
|
9 |
+
- jupyterlab
|
10 |
+
---
|
11 |
+
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
login.html
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "page.html" %}
|
2 |
+
|
3 |
+
|
4 |
+
{% block stylesheet %}
|
5 |
+
{% endblock %}
|
6 |
+
|
7 |
+
{% block site %}
|
8 |
+
|
9 |
+
<div id="jupyter-main-app" class="container">
|
10 |
+
|
11 |
+
<img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="Hugging Face Logo">
|
12 |
+
<h4>You can duplicate this Space to run it private.</h4>
|
13 |
+
<br>
|
14 |
+
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/DockerTemplates/jupyterlab?duplicate=true">
|
15 |
+
<img style="margin: 0" src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
16 |
+
<br>
|
17 |
+
<br>
|
18 |
+
<h4>Token is <span style="color:orange;">huggingface</span></h4>
|
19 |
+
|
20 |
+
{% if login_available %}
|
21 |
+
{# login_available means password-login is allowed. Show the form. #}
|
22 |
+
<div class="row">
|
23 |
+
<div class="navbar col-sm-8">
|
24 |
+
<div class="navbar-inner">
|
25 |
+
<div class="container">
|
26 |
+
<div class="center-nav">
|
27 |
+
<form action="{{base_url}}login?next={{next}}" method="post" class="navbar-form pull-left">
|
28 |
+
{{ xsrf_form_html() | safe }}
|
29 |
+
{% if token_available %}
|
30 |
+
<label for="password_input"><strong>{% trans %}Token:{% endtrans
|
31 |
+
%}</strong></label>
|
32 |
+
{% else %}
|
33 |
+
<label for="password_input"><strong>{% trans %}Password:{% endtrans %}</strong></label>
|
34 |
+
{% endif %}
|
35 |
+
<input type="password" name="password" id="password_input" class="form-control">
|
36 |
+
<button type="submit" class="btn btn-default" id="login_submit">{% trans %}Log in{% endtrans
|
37 |
+
%}</button>
|
38 |
+
</form>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
{% else %}
|
45 |
+
<p>{% trans %}No login available, you shouldn't be seeing this page.{% endtrans %}</p>
|
46 |
+
{% endif %}
|
47 |
+
{% if message %}
|
48 |
+
<div class="row">
|
49 |
+
{% for key in message %}
|
50 |
+
<div class="message {{key}}">
|
51 |
+
{{message[key]}}
|
52 |
+
</div>
|
53 |
+
{% endfor %}
|
54 |
+
</div>
|
55 |
+
{% endif %}
|
56 |
+
{% if token_available %}
|
57 |
+
{% block token_message %}
|
58 |
+
|
59 |
+
{% endblock token_message %}
|
60 |
+
{% endif %}
|
61 |
+
</div>
|
62 |
+
|
63 |
+
{% endblock %}
|
64 |
+
|
65 |
+
|
66 |
+
{% block script %}
|
67 |
+
{% endblock %}
|
on_startup.sh
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
# Write some commands here that will run on root user before startup.
|
3 |
+
# For example, to clone transformers and install it in dev mode:
|
4 |
+
# git clone https://github.com/huggingface/transformers.git
|
5 |
+
# cd transformers && pip install -e ".[dev]"
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
tree
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jupyterlab==3.6.1
|
2 |
+
jupyter-server==2.3.0
|
3 |
+
tornado==6.2
|
4 |
+
ipywidgets
|
start_server.sh
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
|
3 |
+
|
4 |
+
echo "Starting Jupyter Lab with token $JUPYTER_TOKEN"
|
5 |
+
|
6 |
+
jupyter-lab \
|
7 |
+
--ip 0.0.0.0 \
|
8 |
+
--port 7860 \
|
9 |
+
--no-browser \
|
10 |
+
--allow-root \
|
11 |
+
--ServerApp.token="$JUPYTER_TOKEN" \
|
12 |
+
--ServerApp.tornado_settings="{'headers': {'Content-Security-Policy': 'frame-ancestors *'}}" \
|
13 |
+
--ServerApp.cookie_options="{'SameSite': 'None', 'Secure': True}" \
|
14 |
+
--ServerApp.disable_check_xsrf=True \
|
15 |
+
--LabApp.news_url=None \
|
16 |
+
--LabApp.check_for_updates_class="jupyterlab.NeverCheckForUpdate"
|