Artyom Boyko commited on
Commit
b6aaa4a
·
1 Parent(s): e7b360d

Solved the problem with local launch of Devcontainer. Testing the launch in Hugging Face Space.

Browse files
.devcontainer/devcontainer.json CHANGED
@@ -1,7 +1,7 @@
1
  // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
  // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3
  {
4
- "name": "",
5
  // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
  //"image": "mcr.microsoft.com/devcontainers/base:jammy"
7
  "build": {
@@ -24,17 +24,13 @@
24
  "ms-toolsai.tensorboard",
25
  "ms-toolsai.jupyter-keymap",
26
  "ms-toolsai.jupyter-renderers",
27
- "ms-toolsai.vscode-jupyter-slideshow",
28
- "ms-toolsai.datawrangler",
29
- "ms-azuretools.vscode-docker",
30
- "github.vscode-github-actions",
31
- "github.copilot",
32
- "github.copilot-chat",
33
- "mechatroner.rainbow-csv"
34
  ]
35
  }
36
  },
37
- "forwardPorts": [7860],
 
 
38
  "runArgs": [
39
  "--shm-size=1gb",
40
  "--gpus",
 
1
  // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
  // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3
  {
4
+ "name": "Video-Analizer",
5
  // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
  //"image": "mcr.microsoft.com/devcontainers/base:jammy"
7
  "build": {
 
24
  "ms-toolsai.tensorboard",
25
  "ms-toolsai.jupyter-keymap",
26
  "ms-toolsai.jupyter-renderers",
27
+ "ms-toolsai.vscode-jupyter-slideshow"
 
 
 
 
 
 
28
  ]
29
  }
30
  },
31
+ "forwardPorts": ["7860:7860"], // https://code.visualstudio.com/docs/devcontainers/containers#_forwarding-or-publishing-a-port
32
+ // "appPort": ["7860:7860"],
33
+ "overrideCommand": false, // https://code.visualstudio.com/remote/advancedcontainers/start-processes
34
  "runArgs": [
35
  "--shm-size=1gb",
36
  "--gpus",
Dockerfile CHANGED
@@ -3,7 +3,8 @@ FROM python:3.12.10-bookworm
3
  # ENV PIP_ROOT_USER_ACTION=ignore
4
  ARG USERNAME=mcp_user
5
  ARG USER_UID=1000
6
- ARG SRV_WORKDIR=app_srv
 
7
 
8
  WORKDIR /tmp/
9
  COPY requirements.txt packages.txt ./
@@ -48,14 +49,17 @@ USER $USERNAME
48
  # Set home to the user's home directory
49
  ENV HOME=/home/$USERNAME \
50
  PATH=/home/$USERNAME/.local/bin:$PATH
51
- # Set the working directory to the user's home directory
52
- WORKDIR $HOME/$SRV_WORKDIR
53
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
54
- COPY --chown=$USERNAME ./app_srv/* $HOME/$SRV_WORKDIR
 
 
 
 
55
 
56
  # Gradio configuration
57
  EXPOSE 7860
 
58
  ENV GRADIO_SERVER_NAME="0.0.0.0"
59
 
60
- CMD ["python", "app_srv.py"]
61
- # CMD ["bash"]
 
3
  # ENV PIP_ROOT_USER_ACTION=ignore
4
  ARG USERNAME=mcp_user
5
  ARG USER_UID=1000
6
+ ARG APP_WORKDIR=app_srv
7
+
8
 
9
  WORKDIR /tmp/
10
  COPY requirements.txt packages.txt ./
 
49
  # Set home to the user's home directory
50
  ENV HOME=/home/$USERNAME \
51
  PATH=/home/$USERNAME/.local/bin:$PATH
52
+
 
53
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
54
+ RUN mkdir -p $HOME/$APP_WORKDIR
55
+ COPY --chown=$USERNAME ./$APP_WORKDIR/* $HOME/$APP_WORKDIR
56
+
57
+ # Set the working directory to the user's home directory
58
+ WORKDIR $HOME/$APP_WORKDIR
59
 
60
  # Gradio configuration
61
  EXPOSE 7860
62
+
63
  ENV GRADIO_SERVER_NAME="0.0.0.0"
64
 
65
+ CMD ["python", "app_srv.py"]
 
app_srv/app_srv.py CHANGED
@@ -18,4 +18,5 @@ demo = gr.Interface(
18
 
19
  # Запуск приложения
20
  if __name__ == "__main__":
21
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
 
18
 
19
  # Запуск приложения
20
  if __name__ == "__main__":
21
+ # demo.launch(server_name='0.0.0.0', server_port=7860, mcp_server=True)
22
+ demo.launch(server_port=7860, mcp_server=True)
packages.txt CHANGED
@@ -12,3 +12,5 @@ python3-setuptools
12
  python-is-python3
13
  wget
14
  zlib1g
 
 
 
12
  python-is-python3
13
  wget
14
  zlib1g
15
+ net-tools
16
+ lsof
requirements.txt CHANGED
@@ -2,4 +2,5 @@ transformers
2
  datasets
3
  evaluate
4
  gradio
 
5
  uvicorn[standard]
 
2
  datasets
3
  evaluate
4
  gradio
5
+ gradio[mcp]
6
  uvicorn[standard]