triton7777 commited on
Commit
9cdea18
·
verified ·
1 Parent(s): 82a6b8e

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +37 -37
  2. app.py +4 -2
Dockerfile CHANGED
@@ -1,38 +1,38 @@
1
- # Use a smaller CUDA image (runtime, not devel)
2
- FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime
3
-
4
- # Install minimal system dependencies
5
- RUN apt-get update && apt-get install -y \
6
- libglib2.0-0 \
7
- libsm6 \
8
- libxrender-dev \
9
- libxext6 \
10
- libgl1-mesa-glx \
11
- git \
12
- && apt-get clean \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Install mmcv using mim (official way)
16
- RUN pip install openmim
17
- RUN mim install mmengine
18
- RUN mim install mmcv==2.0.1
19
-
20
- # Install mmsegmentation from pip (not git)
21
- RUN pip install mmsegmentation==1.0.0
22
-
23
- # Install your app dependencies
24
- RUN pip install \
25
- gradio==4.29.0 \
26
- huggingface-hub==0.22.2 \
27
- pillow==10.1.0 \
28
- opencv-python-headless==4.8.1.78 \
29
- ftfy==6.1.1 \
30
- regex==2023.12.25
31
-
32
- WORKDIR /app
33
- COPY . .
34
-
35
- # Force CPU mode if CUDA not available
36
- ENV CUDA_VISIBLE_DEVICES=""
37
-
38
  CMD ["python", "app.py"]
 
1
+ # Use a smaller CUDA image (runtime, not devel)
2
+ FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime
3
+
4
+ # Install minimal system dependencies
5
+ RUN apt-get update && apt-get install -y \
6
+ libglib2.0-0 \
7
+ libsm6 \
8
+ libxrender-dev \
9
+ libxext6 \
10
+ libgl1-mesa-glx \
11
+ git \
12
+ && apt-get clean \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Install mmcv using mim (official way)
16
+ RUN pip install openmim
17
+ RUN mim install mmengine
18
+ RUN mim install mmcv==2.0.1
19
+
20
+ # Install mmsegmentation from pip (not git)
21
+ RUN pip install mmsegmentation==1.0.0
22
+
23
+ # Install your app dependencies
24
+ RUN pip install \
25
+ gradio==4.44.1 \
26
+ huggingface-hub==0.22.2 \
27
+ pillow==10.1.0 \
28
+ opencv-python-headless==4.8.1.78 \
29
+ ftfy==6.1.1 \
30
+ regex==2023.12.25
31
+
32
+ WORKDIR /app
33
+ COPY . .
34
+
35
+ # Force CPU mode if CUDA not available
36
+ ENV CUDA_VISIBLE_DEVICES=""
37
+
38
  CMD ["python", "app.py"]
app.py CHANGED
@@ -265,6 +265,8 @@ body, .gradio-container { background: linear-gradient(180deg, #e7f3fb 0%, #d9eef
265
  /* Compact slider styling */
266
  .compact-slider { max-width: 320px; }
267
  .compact-slider .wrap { padding: 0 !important; }
 
 
268
  /* Compact legend styling */
269
  .legend-box { width: 220px; max-height: 480px; overflow: auto; background: transparent; border: none; padding: 4px 4px; }
270
  """
@@ -286,13 +288,13 @@ with gr.Blocks(css=SEA_CSS) as demo:
286
 
287
  with gr.Row():
288
  inp = gr.Image(type="numpy", label="Input image", height=320)
289
- mix = gr.Slider(0.0, 1.0, value=0.5, step=0.05, label="Segmentation mix (0=image, 1=seg)", container=False, elem_classes=["compact-slider"])
290
  if example_paths:
291
  gr.Examples(examples=example_paths, inputs=inp, label="Examples from ./images")
292
 
293
  with gr.Row():
294
  out = gr.Image(type="numpy", label="Segmentation overlay", height=512)
295
- legend = gr.HTML(value="", elem_classes=["legend-box"], container=False)
296
  btn = gr.Button("Segment")
297
 
298
  # Hold last input image and segmentation RGB to re-blend without re-inference
 
265
  /* Compact slider styling */
266
  .compact-slider { max-width: 320px; }
267
  .compact-slider .wrap { padding: 0 !important; }
268
+ /* Remove component box chrome where undesired */
269
+ .no-box .gr-box { box-shadow: none !important; border: none !important; background: transparent !important; padding: 0 !important; }
270
  /* Compact legend styling */
271
  .legend-box { width: 220px; max-height: 480px; overflow: auto; background: transparent; border: none; padding: 4px 4px; }
272
  """
 
288
 
289
  with gr.Row():
290
  inp = gr.Image(type="numpy", label="Input image", height=320)
291
+ mix = gr.Slider(0.0, 1.0, value=0.5, step=0.05, label="Segmentation mix (0=image, 1=seg)", elem_classes=["compact-slider", "no-box"])
292
  if example_paths:
293
  gr.Examples(examples=example_paths, inputs=inp, label="Examples from ./images")
294
 
295
  with gr.Row():
296
  out = gr.Image(type="numpy", label="Segmentation overlay", height=512)
297
+ legend = gr.HTML(value="", elem_classes=["legend-box", "no-box"])
298
  btn = gr.Button("Segment")
299
 
300
  # Hold last input image and segmentation RGB to re-blend without re-inference