Yusin commited on
Commit
5812856
·
verified ·
1 Parent(s): a9a90a7

Upload 6 files

Browse files
Files changed (6) hide show
  1. Dockerfile +104 -0
  2. README.md +6 -4
  3. login.html +72 -0
  4. on_startup.sh +5 -0
  5. requirements.txt +89 -0
  6. start_server.sh +21 -0
Dockerfile ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ xsel\
17
+ unzip \
18
+ htop \
19
+ bzip2 \
20
+ libx11-6 \
21
+ build-essential \
22
+ libsndfile-dev \
23
+ software-properties-common \
24
+ && rm -rf /var/lib/apt/lists/*
25
+
26
+ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
27
+ apt-get upgrade -y && \
28
+ apt-get install -y --no-install-recommends nvtop
29
+
30
+ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
31
+ apt-get install -y nodejs && \
32
+ npm install -g configurable-http-proxy
33
+
34
+ # Create a working directory
35
+ WORKDIR /app
36
+
37
+ # Create a non-root user and switch to it
38
+ RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
39
+ && chown -R user:user /app
40
+ RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
41
+ USER user
42
+
43
+ # All users can use /home/user as their home directory
44
+ ENV HOME=/home/user
45
+ RUN mkdir $HOME/.cache $HOME/.config \
46
+ && chmod -R 777 $HOME
47
+
48
+ # Set up the Conda environment
49
+ ENV CONDA_AUTO_UPDATE_CONDA=false \
50
+ PATH=$HOME/miniconda/bin:$PATH
51
+ RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
52
+ && chmod +x ~/miniconda.sh \
53
+ && ~/miniconda.sh -b -p ~/miniconda \
54
+ && rm ~/miniconda.sh \
55
+ && conda clean -ya
56
+
57
+ RUN pip install --upgrade pip==22.2.2
58
+
59
+ WORKDIR $HOME/app
60
+
61
+ #######################################
62
+ # Start root user section
63
+ #######################################
64
+
65
+ USER root
66
+
67
+ # User Debian packages
68
+ ## Security warning : Potential user code executed as root (build time)
69
+ RUN --mount=target=/root/packages.txt,source=packages.txt \
70
+ apt-get update && \
71
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
72
+ && rm -rf /var/lib/apt/lists/*
73
+
74
+ RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
75
+ bash /root/on_startup.sh
76
+
77
+ RUN mkdir /data && chown user:user /data
78
+
79
+ #######################################
80
+ # End root user section
81
+ #######################################
82
+
83
+ USER user
84
+
85
+ # Python packages
86
+ RUN --mount=target=requirements.txt,source=requirements.txt \
87
+ pip install --no-cache-dir --upgrade -r requirements.txt
88
+
89
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
90
+ COPY --chown=user . $HOME/app
91
+
92
+ RUN chmod +x start_server.sh
93
+
94
+ COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
95
+
96
+ ENV PYTHONUNBUFFERED=1 \
97
+ GRADIO_ALLOW_FLAGGING=never \
98
+ GRADIO_NUM_PORTS=1 \
99
+ GRADIO_SERVER_NAME=0.0.0.0 \
100
+ GRADIO_THEME=huggingface \
101
+ SYSTEM=spaces \
102
+ SHELL=/bin/bash
103
+
104
+ CMD ["./start_server.sh"]
README.md CHANGED
@@ -1,11 +1,13 @@
1
  ---
2
- title: GeoAgent
3
- emoji: 📉
4
- colorFrom: yellow
5
  colorTo: green
6
  sdk: docker
7
  pinned: false
8
- license: mit
 
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: JupyterLab
3
+ emoji: 💻🐳
4
+ colorFrom: gray
5
  colorTo: green
6
  sdk: docker
7
  pinned: false
8
+ tags:
9
+ - jupyterlab
10
+ suggested_storage: small
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
login.html ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends "page.html" %}
2
+
3
+ {% block stylesheet %}
4
+ {% endblock %}
5
+
6
+ {% block site %}
7
+ <div id="jupyter-main-app" class="container">
8
+ <img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="Hugging Face Logo">
9
+ <h4>You can just run here or duplicate this Space to run it private.</h4>
10
+ <br>
11
+ <a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/DockerTemplates/jupyterlab?duplicate=true">
12
+ <img style="margin: 0" src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&amp;style=flat&amp;logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&amp;logoWidth=14" alt="Duplicate Space">
13
+ </a>
14
+ <br><br>
15
+ <h4>The default token is <span style="color:orange;">huggingface</span></h4>
16
+ <h4>You can keep all settings default</h4>
17
+
18
+ {% if login_available %}
19
+ <div class="row">
20
+ <div class="navbar col-sm-8">
21
+ <div class="navbar-inner">
22
+ <div class="container">
23
+ <div class="center-nav">
24
+ <form action="{{base_url}}login?next={{next}}" method="post" class="navbar-form pull-left">
25
+ {{ xsrf_form_html() | safe }}
26
+ {% if token_available %}
27
+ <label for="password_input"><strong>Token:</strong></label>
28
+ {% else %}
29
+ <label for="password_input"><strong>Password:</strong></label>
30
+ {% endif %}
31
+ <input type="password" name="password" id="password_input" class="form-control">
32
+ <button type="submit" class="btn btn-default" id="login_submit">Log in</button>
33
+ </form>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ {% else %}
40
+ <p>No login available, you shouldn't be seeing this page.</p>
41
+ {% endif %}
42
+
43
+ <p>This template was created by <a href="https://twitter.com/camenduru" target="_blank">camenduru</a> and others.</p>
44
+
45
+ {% if message %}
46
+ <div class="row">
47
+ {% for key in message %}
48
+ <div class="message {{key}}">
49
+ {{message[key]}}
50
+ </div>
51
+ {% endfor %}
52
+ </div>
53
+ {% endif %}
54
+ </div>
55
+ {% endblock %}
56
+
57
+ {% block script %}
58
+ <script>
59
+ // 自动填入 token 并自动登录
60
+ window.onload = function () {
61
+ const token = "GeoAgent"; // 你可以改成自己的 token
62
+ const input = document.getElementById("password_input");
63
+ const button = document.getElementById("login_submit");
64
+ if (input && button) {
65
+ input.value = token;
66
+ setTimeout(() => {
67
+ button.click();
68
+ }, 500); // 等页面渲染后再点击
69
+ }
70
+ };
71
+ </script>
72
+ {% 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]"
requirements.txt ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jupyterlab==4.1.5
2
+ jupyter-server==2.13.0
3
+ tornado==6.2
4
+ ipywidgets
5
+ # metagpt
6
+ aiohttp==3.8.6
7
+ #azure_storage==0.37.0
8
+ channels==4.0.0
9
+ # Django==4.1.5
10
+ # docx==0.2.4
11
+ #faiss==1.5.3
12
+ faiss_cpu==1.7.4
13
+ fire==0.4.0
14
+ typer==0.9.0
15
+ # godot==0.1.1
16
+ # google_api_python_client==2.93.0 # Used by search_engine.py
17
+ lancedb==0.4.0
18
+ loguru==0.6.0
19
+ meilisearch==0.21.0
20
+ numpy==1.24.3
21
+ openai==1.6.1
22
+ openpyxl
23
+ beautifulsoup4==4.12.3
24
+ pandas==2.1.1
25
+ pydantic==2.5.3
26
+ #pygame==2.1.3
27
+ #pymilvus==2.2.8
28
+ # pytest==7.2.2 # test extras require
29
+ python_docx==0.8.11
30
+ PyYAML==6.0.1
31
+ # sentence_transformers==2.2.2
32
+ setuptools==65.6.3
33
+ tenacity==8.2.3
34
+ tiktoken==0.6.0
35
+ tqdm==4.66.2
36
+ #unstructured[local-inference]
37
+ # selenium>4
38
+ # webdriver_manager<3.9
39
+ anthropic==0.18.1
40
+ typing-inspect==0.8.0
41
+ libcst==1.0.1
42
+ qdrant-client==1.7.0
43
+ # pytest-mock==3.11.1 # test extras require
44
+ # open-interpreter==0.1.7; python_version>"3.9" # Conflict with openai 1.x
45
+ ta==0.10.2
46
+ semantic-kernel==0.4.3.dev0
47
+ wrapt==1.15.0
48
+ #aiohttp_jinja2
49
+ # azure-cognitiveservices-speech~=1.31.0 # Used by metagpt/tools/azure_tts.py
50
+ #aioboto3~=11.3.0 # Used by metagpt/utils/s3.py
51
+ aioredis~=2.0.1 # Used by metagpt/utils/redis.py
52
+ websocket-client==1.6.2
53
+ aiofiles==23.2.1
54
+ gitpython==3.1.40
55
+ zhipuai==2.0.1
56
+ rich==13.6.0
57
+ nbclient==0.9.0
58
+ nbformat==5.9.2
59
+ ipython==8.17.2
60
+ ipykernel==6.27.1
61
+ scikit_learn==1.3.2
62
+ typing-extensions==4.9.0
63
+ socksio~=1.0.0
64
+ gitignore-parser==0.1.9
65
+ # connexion[uvicorn]~=3.0.5 # Used by metagpt/tools/openapi_v3_hello.py
66
+ websockets~=11.0
67
+ networkx~=3.2.1
68
+ #google-generativeai==0.4.1
69
+ playwright>=1.26 # used at metagpt/tools/libs/web_scraping.py
70
+ anytree
71
+ ipywidgets==8.1.1
72
+ Pillow
73
+ imap_tools==1.5.0 # Used by metagpt/tools/libs/email_login.py
74
+ qianfan==0.3.2
75
+ dashscope==1.14.1
76
+ rank-bm25==0.2.2 # for tool recommendation
77
+ gymnasium==0.29.1
78
+ jieba
79
+ ipylab
80
+ leafmap
81
+ huggingface-hub
82
+ llama-index
83
+ llama-index-embeddings-huggingface
84
+ llama-index-llms-openai-like
85
+ llama-index-llms-openai-like
86
+ llama-index-vector-stores-chroma
87
+ #terratorch #py3.11
88
+ iso8601
89
+
start_server.sh ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
3
+
4
+ echo "Starting Jupyter Lab with token $JUPYTER_TOKEN"
5
+
6
+ NOTEBOOK_DIR="/home/user/app"
7
+
8
+ jupyter-lab \
9
+ --ip 0.0.0.0 \
10
+ --port 7860 \
11
+ --no-browser \
12
+ --allow-root \
13
+ --ServerApp.token="$JUPYTER_TOKEN" \
14
+ --ServerApp.tornado_settings="{'headers': {'Content-Security-Policy': 'frame-ancestors *'}}" \
15
+ --ServerApp.cookie_options="{'SameSite': 'None', 'Secure': True}" \
16
+ --ServerApp.disable_check_xsrf=True \
17
+ --LabApp.news_url=None \
18
+ --LabApp.check_for_updates_class="jupyterlab.NeverCheckForUpdate" \
19
+ --notebook-dir=$NOTEBOOK_DIR \
20
+ --NotebookApp.default_url="/lab/tree/GeoAgent-20250427.ipynb"
21
+