chenx906 commited on
Commit
2183bac
·
1 Parent(s): 62d12de

Fix the deployment space problem

Browse files
Files changed (3) hide show
  1. Dockerfile +2 -6
  2. api/app.py +6 -1
  3. requirements.txt +3 -1
Dockerfile CHANGED
@@ -1,19 +1,15 @@
1
  FROM python:3.9-slim
2
-
3
  RUN useradd -m -u 1000 user
4
  WORKDIR /app
5
 
6
  COPY requirements.txt .
7
  RUN pip install --no-cache-dir -r requirements.txt
8
- # If torch/pillow/requests aren’t in requirements.txt, add:
9
  # RUN pip install --no-cache-dir torch pillow requests
10
 
11
- # Copy your project
12
  COPY --chown=user:user . .
13
-
14
  RUN chown -R user:user /app
15
  USER user
16
- EXPOSE 7860
17
 
18
- # Run your Gradio app (api/app.py must exist)
19
  CMD ["python", "api/app.py"]
 
1
  FROM python:3.9-slim
 
2
  RUN useradd -m -u 1000 user
3
  WORKDIR /app
4
 
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
+ # (only if torch/pillow/requests aren’t already in requirements.txt)
8
  # RUN pip install --no-cache-dir torch pillow requests
9
 
 
10
  COPY --chown=user:user . .
 
11
  RUN chown -R user:user /app
12
  USER user
 
13
 
14
+ EXPOSE 7860
15
  CMD ["python", "api/app.py"]
api/app.py CHANGED
@@ -62,4 +62,9 @@ demo = gr.Interface(
62
  theme=gr.themes.Base()
63
  )
64
 
65
- demo.launch()
 
 
 
 
 
 
62
  theme=gr.themes.Base()
63
  )
64
 
65
+ demo.launch(
66
+ server_name="0.0.0.0",
67
+ server_port=7860,
68
+ share=False,
69
+ show_api=False, # <-- avoids the json_schema path in older gradio_client
70
+ )
requirements.txt CHANGED
@@ -4,5 +4,7 @@ Pillow
4
  numpy
5
  timm
6
  pyyaml
7
- gradio==4.44.0
 
8
  huggingface_hub<0.25
 
 
4
  numpy
5
  timm
6
  pyyaml
7
+ gradio==4.44.1
8
+ gradio_client==1.4.2
9
  huggingface_hub<0.25
10
+