bapi143 commited on
Commit
c19154e
·
1 Parent(s): 5fd7795

Configure Docker SDK on port 7860 for CropAI FastAPI

Browse files
Files changed (2) hide show
  1. Dockerfile +46 -0
  2. README.md +14 -9
Dockerfile ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ==============================================================================
2
+ # CropAI Hugging Face Spaces Production Dockerfile
3
+ # Optimized for Hugging Face Spaces Free Tier (2 vCPU, 16 GB RAM, Port 7860)
4
+ # User UID 1000 required by Hugging Face Spaces security sandbox
5
+ # ==============================================================================
6
+
7
+ FROM python:3.11-slim
8
+
9
+ # Create Hugging Face default non-root user (UID 1000)
10
+ RUN useradd -m -u 1000 user
11
+ WORKDIR /app
12
+
13
+ ENV PYTHONUNBUFFERED=1 \
14
+ PYTHONDONTWRITEBYTECODE=1 \
15
+ PORT=7860 \
16
+ HOST=0.0.0.0 \
17
+ APP_ENV=production
18
+
19
+ # Install OS libraries for Pillow and native builds
20
+ RUN apt-get update && apt-get install -y --no-install-recommends \
21
+ build-essential \
22
+ libjpeg-dev \
23
+ zlib1g-dev \
24
+ curl \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ # Install Python packages
28
+ COPY backend/requirements.txt /app/requirements.txt
29
+ RUN pip install --no-cache-dir --upgrade pip && \
30
+ pip install --no-cache-dir -r /app/requirements.txt
31
+
32
+ # Copy entire backend source code
33
+ COPY backend /app/backend
34
+
35
+ # Grant ownership to non-root user
36
+ RUN chown -R user:user /app
37
+ USER user
38
+
39
+ EXPOSE 7860
40
+
41
+ # Healthcheck
42
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
43
+ CMD curl -f http://localhost:7860/health || exit 1
44
+
45
+ # Start FastAPI application on Port 7860
46
+ CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,15 +1,20 @@
1
  ---
2
  title: CropAI
3
- emoji: ⚡
4
- colorFrom: indigo
5
- colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 6.30.0
8
- python_version: '3.12'
9
- app_file: app.py
10
  pinned: false
11
  license: mit
12
- short_description: CropAI Backend
13
  ---
14
 
15
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
1
  ---
2
  title: CropAI
3
+ emoji: 🌾
4
+ colorFrom: green
5
+ colorTo: emerald
6
+ sdk: docker
7
+ app_port: 7860
 
 
8
  pinned: false
9
  license: mit
10
+ short_description: CropAI Enterprise Agronomic Backend API
11
  ---
12
 
13
+ # 🌾 CropAI: Autonomous Agricultural Pathology & Advisory Backend
14
+
15
+ Enterprise-grade cloud inference backend for agricultural crop pathology detection and agronomic advisory.
16
+
17
+ - **FastAPI Swagger Documentation:** [https://bapi143-cropai.hf.space/docs](https://bapi143-cropai.hf.space/docs)
18
+ - **Health Endpoint:** [https://bapi143-cropai.hf.space/health](https://bapi143-cropai.hf.space/health)
19
+ - **Supported Pathologies:** 127+ syndromes across Cereals, Pulses, Oilseeds, Vegetables, Fruits, Cash Crops
20
+ - **Powered by:** Google Gemini 3.8 Flash Multimodal Vision & 16 Agronomic Engines