Spaces:
Sleeping
Sleeping
udbhav
commited on
Commit
Β·
6f0ecbc
1
Parent(s):
30c62ef
fixed network
Browse files- Dockerfile +0 -193
- app.py +5 -5
Dockerfile
CHANGED
|
@@ -77,196 +77,3 @@ EXPOSE 7860
|
|
| 77 |
# Run app
|
| 78 |
CMD ["python", "app.py"]
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
# # -------------------------------------------------------------
|
| 85 |
-
# # Base image: NVIDIA CUDA (Ubuntu 22.04 jammy)
|
| 86 |
-
# # -------------------------------------------------------------
|
| 87 |
-
# FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
|
| 88 |
-
|
| 89 |
-
# # Non-interactive apt
|
| 90 |
-
# ENV DEBIAN_FRONTEND=noninteractive
|
| 91 |
-
# ENV PYTHONUNBUFFERED=1
|
| 92 |
-
# ENV CUDA_HOME=/usr/local/cuda
|
| 93 |
-
# ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
|
| 94 |
-
# ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
| 95 |
-
|
| 96 |
-
# # -------------------------------------------------------------
|
| 97 |
-
# # System dependencies + Python 3.12
|
| 98 |
-
# # -------------------------------------------------------------
|
| 99 |
-
# RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 100 |
-
# software-properties-common \
|
| 101 |
-
# ca-certificates \
|
| 102 |
-
# curl wget git build-essential \
|
| 103 |
-
# libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
|
| 104 |
-
# libgomp1 libgcc-s1 \
|
| 105 |
-
# && add-apt-repository ppa:deadsnakes/ppa -y \
|
| 106 |
-
# && apt-get update && apt-get install -y --no-install-recommends \
|
| 107 |
-
# python3.12 python3.12-dev python3.12-venv \
|
| 108 |
-
# && rm -rf /var/lib/apt/lists/*
|
| 109 |
-
|
| 110 |
-
# # Install pip for Python 3.12
|
| 111 |
-
# RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
|
| 112 |
-
# && python3.12 /tmp/get-pip.py \
|
| 113 |
-
# && rm /tmp/get-pip.py
|
| 114 |
-
|
| 115 |
-
# # Make 'python' and 'pip' point to 3.12
|
| 116 |
-
# RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
|
| 117 |
-
# ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
|
| 118 |
-
|
| 119 |
-
# # -------------------------------------------------------------
|
| 120 |
-
# # Writable app data & Hugging Face cache
|
| 121 |
-
# # -------------------------------------------------------------
|
| 122 |
-
# ENV APP_DATA_DIR=/data
|
| 123 |
-
# ENV HF_HOME=/data/hf_home
|
| 124 |
-
# ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
|
| 125 |
-
# ENV TRANSFORMERS_CACHE=/data/hf_home
|
| 126 |
-
# ENV MPLCONFIGDIR=/data/matplotlib
|
| 127 |
-
|
| 128 |
-
# RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
|
| 129 |
-
# && chmod -R 777 /data
|
| 130 |
-
|
| 131 |
-
# # -------------------------------------------------------------
|
| 132 |
-
# # Install frpc (for Gradio share=True, though share=False is default)
|
| 133 |
-
# # -------------------------------------------------------------
|
| 134 |
-
# RUN mkdir -p /data/hf_home/gradio/frpc && \
|
| 135 |
-
# wget https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 -O /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3 && \
|
| 136 |
-
# chmod +x /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3
|
| 137 |
-
|
| 138 |
-
# # -------------------------------------------------------------
|
| 139 |
-
# # Application setup
|
| 140 |
-
# # -------------------------------------------------------------
|
| 141 |
-
# WORKDIR /app
|
| 142 |
-
|
| 143 |
-
# # Copy requirements first (better caching)
|
| 144 |
-
# COPY requirements.txt .
|
| 145 |
-
|
| 146 |
-
# # Install Python deps
|
| 147 |
-
# RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
|
| 148 |
-
# && pip install --no-cache-dir -r requirements.txt
|
| 149 |
-
|
| 150 |
-
# # Copy the rest of the source
|
| 151 |
-
# COPY . .
|
| 152 |
-
|
| 153 |
-
# # Create cache directory for downloaded repos
|
| 154 |
-
# RUN mkdir -p /app/cache && chmod 777 /app/cache
|
| 155 |
-
|
| 156 |
-
# # Permissions
|
| 157 |
-
# RUN chmod +x app.py
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
# # -------------------------------------------------------------
|
| 161 |
-
# # Entrypoint for handling corporate CA certs + app launch
|
| 162 |
-
# # -------------------------------------------------------------
|
| 163 |
-
# COPY entrypoint.sh /entrypoint.sh
|
| 164 |
-
# RUN chmod +x /entrypoint.sh
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
# # SWITCH TO USER
|
| 168 |
-
# RUN chown -R 1000:1000 /app
|
| 169 |
-
|
| 170 |
-
# # Expose Gradio port
|
| 171 |
-
# EXPOSE 7860
|
| 172 |
-
|
| 173 |
-
# # Run app via entrypoint (this script will handle cert injection at runtime)
|
| 174 |
-
# ENTRYPOINT ["/entrypoint.sh"]
|
| 175 |
-
|
| 176 |
-
# # Default command
|
| 177 |
-
# CMD ["python", "app.py"]
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
# # -------------------------------------------------------------
|
| 182 |
-
# # Base image: NVIDIA CUDA (Ubuntu 22.04 jammy)
|
| 183 |
-
# # -------------------------------------------------------------
|
| 184 |
-
# FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
|
| 185 |
-
|
| 186 |
-
# USER root
|
| 187 |
-
|
| 188 |
-
# # Non-interactive apt
|
| 189 |
-
# ENV DEBIAN_FRONTEND=noninteractive
|
| 190 |
-
# ENV PYTHONUNBUFFERED=1
|
| 191 |
-
# ENV CUDA_HOME=/usr/local/cuda
|
| 192 |
-
# ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
|
| 193 |
-
# ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
| 194 |
-
|
| 195 |
-
# # -------------------------------------------------------------
|
| 196 |
-
# # System dependencies + Python 3.12
|
| 197 |
-
# # -------------------------------------------------------------
|
| 198 |
-
# RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 199 |
-
# software-properties-common \
|
| 200 |
-
# ca-certificates \
|
| 201 |
-
# curl wget git build-essential \
|
| 202 |
-
# libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
|
| 203 |
-
# libgomp1 libgcc-s1 \
|
| 204 |
-
# && add-apt-repository ppa:deadsnakes/ppa -y \
|
| 205 |
-
# && apt-get update && apt-get install -y --no-install-recommends \
|
| 206 |
-
# python3.12 python3.12-dev python3.12-venv \
|
| 207 |
-
# && rm -rf /var/lib/apt/lists/*
|
| 208 |
-
|
| 209 |
-
# # Install pip for Python 3.12
|
| 210 |
-
# RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
|
| 211 |
-
# && python3.12 /tmp/get-pip.py \
|
| 212 |
-
# && rm /tmp/get-pip.py
|
| 213 |
-
|
| 214 |
-
# # Make 'python' and 'pip' point to 3.12
|
| 215 |
-
# RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
|
| 216 |
-
# ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
|
| 217 |
-
|
| 218 |
-
# # -------------------------------------------------------------
|
| 219 |
-
# # Writable app data & Hugging Face cache
|
| 220 |
-
# # -------------------------------------------------------------
|
| 221 |
-
# ENV APP_DATA_DIR=/data
|
| 222 |
-
# ENV HF_HOME=/data/hf_home
|
| 223 |
-
# ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
|
| 224 |
-
# ENV TRANSFORMERS_CACHE=/data/hf_home
|
| 225 |
-
# ENV MPLCONFIGDIR=/data/matplotlib
|
| 226 |
-
|
| 227 |
-
# RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
|
| 228 |
-
# && chmod -R 777 /data
|
| 229 |
-
|
| 230 |
-
# # -------------------------------------------------------------
|
| 231 |
-
# # Install frpc (for Gradio share=True, though share=False is default)
|
| 232 |
-
# # -------------------------------------------------------------
|
| 233 |
-
# RUN mkdir -p /data/hf_home/gradio/frpc && \
|
| 234 |
-
# wget https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 -O /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3 && \
|
| 235 |
-
# chmod +x /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3
|
| 236 |
-
|
| 237 |
-
# # -------------------------------------------------------------
|
| 238 |
-
# # Application setup
|
| 239 |
-
# # -------------------------------------------------------------
|
| 240 |
-
# WORKDIR /app
|
| 241 |
-
|
| 242 |
-
# # Copy requirements first (better caching)
|
| 243 |
-
# COPY requirements.txt .
|
| 244 |
-
|
| 245 |
-
# # Install Python deps
|
| 246 |
-
# RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
|
| 247 |
-
# && pip install --no-cache-dir -r requirements.txt
|
| 248 |
-
|
| 249 |
-
# # Copy the rest of the source
|
| 250 |
-
# COPY . .
|
| 251 |
-
|
| 252 |
-
# # Create cache directory for downloaded repos
|
| 253 |
-
# RUN mkdir -p /app/cache && chmod 777 /app/cache
|
| 254 |
-
|
| 255 |
-
# # Permissions (optional, since we run as root)
|
| 256 |
-
# RUN chmod +x app.py
|
| 257 |
-
|
| 258 |
-
# # -------------------------------------------------------------
|
| 259 |
-
# # Entrypoint for handling corporate CA certs + app launch
|
| 260 |
-
# # -------------------------------------------------------------
|
| 261 |
-
# COPY entrypoint.sh /entrypoint.sh
|
| 262 |
-
# RUN chmod +x /entrypoint.sh
|
| 263 |
-
|
| 264 |
-
# # Expose Gradio port
|
| 265 |
-
# EXPOSE 7860
|
| 266 |
-
|
| 267 |
-
# # Run app via entrypoint (root user always)
|
| 268 |
-
# ENTRYPOINT ["bash", "/entrypoint.sh"]
|
| 269 |
-
|
| 270 |
-
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -7,11 +7,11 @@ from pathlib import Path
|
|
| 7 |
import traceback
|
| 8 |
|
| 9 |
# Proxy support (office networks often require this)
|
| 10 |
-
proxy = os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy")
|
| 11 |
-
if proxy:
|
| 12 |
-
|
| 13 |
-
else:
|
| 14 |
-
|
| 15 |
|
| 16 |
# Writable base dir
|
| 17 |
DATA_DIR = os.environ.get("APP_DATA_DIR", os.path.join(tempfile.gettempdir(), "appdata"))
|
|
|
|
| 7 |
import traceback
|
| 8 |
|
| 9 |
# Proxy support (office networks often require this)
|
| 10 |
+
# proxy = os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy")
|
| 11 |
+
# if proxy:
|
| 12 |
+
# print(f"π Using proxy: {proxy}")
|
| 13 |
+
# else:
|
| 14 |
+
# print("π No proxy detected, connecting directly")
|
| 15 |
|
| 16 |
# Writable base dir
|
| 17 |
DATA_DIR = os.environ.get("APP_DATA_DIR", os.path.join(tempfile.gettempdir(), "appdata"))
|