jingyangcarl commited on
Commit
82ac033
·
1 Parent(s): eab9210
Files changed (3) hide show
  1. .vscode/launch.json +27 -0
  2. DockerFile +12 -11
  3. install.sh +5 -4
.vscode/launch.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Python Debugger: Current File",
9
+ "type": "debugpy",
10
+ "request": "launch",
11
+ "program": "${file}",
12
+ "console": "integratedTerminal"
13
+ },
14
+ {
15
+ "name": "Python Debugger: app.py",
16
+ "type": "debugpy",
17
+ "request": "launch",
18
+ "program": "app.py",
19
+ "console": "integratedTerminal",
20
+ "justMyCode": false,
21
+ "env": {
22
+ "CUDA_VISIBLE_DEVICES": "7",
23
+ "GRADIO_SERVER_PORT": "7864",
24
+ }
25
+ }
26
+ ]
27
+ }
DockerFile CHANGED
@@ -1,23 +1,24 @@
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.11
5
 
6
  WORKDIR /code
 
7
 
8
- COPY ./pre-requirements.txt /code/pre-requirements.txt
9
-
10
- RUN pip install --no-cache-dir --upgrade -r /code/pre-requirements.txt
11
 
12
  # Set up a new user named "user" with user ID 1000
13
  RUN useradd -m -u 1000 user
14
-
15
  # Switch to the "user" user
16
  USER user
17
-
18
  # Set home to the user's home directory
19
  ENV HOME=/home/user \
20
- PATH=/home/user/.local/bin:$PATH
 
 
 
 
 
 
21
 
22
  # Set the working directory to the user's home directory
23
  WORKDIR $HOME/app
@@ -25,4 +26,4 @@ WORKDIR $HOME/app
25
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
26
  COPY --chown=user . $HOME/app
27
 
28
- CMD ["python", "app.py"]
 
1
+ FROM continuumio/anaconda3:main
 
 
 
2
 
3
  WORKDIR /code
4
+ COPY ./environment.yml /code/environment.yml
5
 
6
+ # Create the environment using the environment.yml file
7
+ RUN conda env create -f /code/environment.yml
 
8
 
9
  # Set up a new user named "user" with user ID 1000
10
  RUN useradd -m -u 1000 user
 
11
  # Switch to the "user" user
12
  USER user
 
13
  # Set home to the user's home directory
14
  ENV HOME=/home/user \
15
+ PYTHONPATH=$HOME/app \
16
+ PYTHONUNBUFFERED=1 \
17
+ GRADIO_ALLOW_FLAGGING=never \
18
+ GRADIO_NUM_PORTS=1 \
19
+ GRADIO_SERVER_NAME=0.0.0.0 \
20
+ GRADIO_THEME=huggingface \
21
+ SYSTEM=spaces
22
 
23
  # Set the working directory to the user's home directory
24
  WORKDIR $HOME/app
 
26
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
27
  COPY --chown=user . $HOME/app
28
 
29
+ CMD ["./run.sh"]
install.sh CHANGED
@@ -1,6 +1,7 @@
1
- conda activate base
2
- conda remove -n matgen-plus --all
3
-
 
4
 
5
  conda create -n matgen-plus python=3.11
6
  conda activate matgen-plus
@@ -14,4 +15,4 @@ conda install pytorch3d -c pytorch -c conda-forge
14
  conda install -c conda-forge open-clip-torch pytorch-lightning
15
  pip install trimesh xatlas scikit-learn opencv-python omegaconf
16
 
17
- bash run.sh
 
1
+ #!/bin/bash
2
+ eval "$(conda shell.bash hook)"
3
+ # conda activate base
4
+ # conda remove -n matgen-plus --all
5
 
6
  conda create -n matgen-plus python=3.11
7
  conda activate matgen-plus
 
15
  conda install -c conda-forge open-clip-torch pytorch-lightning
16
  pip install trimesh xatlas scikit-learn opencv-python omegaconf
17
 
18
+ python app.py