JatsTheAIGen commited on
Commit
ca75c2d
·
1 Parent(s): aaf4201

api migration

Browse files
Files changed (3) hide show
  1. Dockerfile +39 -0
  2. Dockerfile.hf +13 -9
  3. README.md +2 -2
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for Hugging Face Spaces (Docker SDK)
2
+ # This is the main Dockerfile used by HF Spaces when sdk: docker is set
3
+ FROM python:3.10-slim
4
+
5
+ # System dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ gcc \
8
+ g++ \
9
+ cmake \
10
+ libopenblas-dev \
11
+ libomp-dev \
12
+ curl \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Set working directory
16
+ WORKDIR /app
17
+
18
+ # Copy requirements first for better caching
19
+ COPY requirements.txt .
20
+
21
+ # Install Python dependencies
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy application code
25
+ COPY . .
26
+
27
+ # Expose ports
28
+ # 7860: Gradio UI (primary, exposed by HF Spaces)
29
+ # 5001: Flask API (runs in background thread)
30
+ EXPOSE 7860 5001
31
+
32
+ # Health check - check Gradio endpoint
33
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
34
+ CMD curl -f http://localhost:7860/ || exit 1
35
+
36
+ # Run main.py (starts both Gradio and Flask API)
37
+ # main.py starts Flask API in background thread and launches Gradio
38
+ CMD ["python", "main.py"]
39
+
Dockerfile.hf CHANGED
@@ -1,5 +1,5 @@
1
- # Dockerfile.hf
2
- FROM python:3.9-slim
3
 
4
  # System dependencies
5
  RUN apt-get update && apt-get install -y \
@@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y \
8
  cmake \
9
  libopenblas-dev \
10
  libomp-dev \
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
  # Set working directory
@@ -22,13 +23,16 @@ RUN pip install --no-cache-dir -r requirements.txt
22
  # Copy application code
23
  COPY . .
24
 
25
- # Expose port for Gradio
26
- EXPOSE 7860
 
 
27
 
28
- # Health check
29
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
30
- CMD python -c "import requests; requests.get('http://localhost:7860')"
31
 
32
- # Run the application
33
- CMD ["python", "app.py"]
 
34
 
 
1
+ # Dockerfile for Hugging Face Spaces (Docker SDK)
2
+ FROM python:3.10-slim
3
 
4
  # System dependencies
5
  RUN apt-get update && apt-get install -y \
 
8
  cmake \
9
  libopenblas-dev \
10
  libomp-dev \
11
+ curl \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
  # Set working directory
 
23
  # Copy application code
24
  COPY . .
25
 
26
+ # Expose ports
27
+ # 7860: Gradio UI (primary, exposed by HF Spaces)
28
+ # 5001: Flask API (runs in background thread)
29
+ EXPOSE 7860 5001
30
 
31
+ # Health check - check Gradio endpoint
32
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
33
+ CMD curl -f http://localhost:7860/ || exit 1
34
 
35
+ # Run main.py (starts both Gradio and Flask API)
36
+ # main.py starts Flask API in background thread and launches Gradio
37
+ CMD ["python", "main.py"]
38
 
README.md CHANGED
@@ -3,8 +3,8 @@ title: AI Research Assistant MVP
3
  emoji: 🧠
4
  colorFrom: blue
5
  colorTo: purple
6
- sdk: gradio
7
- app_file: app.py
8
  pinned: false
9
  license: apache-2.0
10
  tags:
 
3
  emoji: 🧠
4
  colorFrom: blue
5
  colorTo: purple
6
+ sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
  license: apache-2.0
10
  tags: