File size: 1,871 Bytes
816212a
 
 
 
 
 
 
 
8f3e3b4
816212a
 
 
8f3e3b4
 
 
 
 
 
816212a
 
 
 
8f3e3b4
 
816212a
 
7e363c8
816212a
 
 
 
a4e031f
816212a
 
 
 
 
 
 
81e91e5
 
 
 
64a4809
81e91e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816212a
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ScamShield AI - Hugging Face Spaces Docker Image
# Optimized for Hugging Face deployment

FROM python:3.11-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    libpq5 \
    git \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

# Upgrade pip first
RUN pip install --no-cache-dir --upgrade pip setuptools wheel

# Copy requirements first for caching
COPY requirements.txt .

# Install Python dependencies with increased timeout
RUN pip install --no-cache-dir --timeout 1000 -r requirements.txt

# Download spaCy model
RUN pip install --no-cache-dir https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl

# Copy application code
COPY app/ ./app/
COPY scripts/ ./scripts/
COPY ui/ ./ui/

# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV ENVIRONMENT=production

# Default configuration (non-sensitive values)
# Sensitive values (GROQ_API_KEY, API_KEY, etc.) should be set as HF Secrets
ENV DEBUG=false
ENV LOG_LEVEL=INFO
ENV GROQ_MODEL=llama-3.1-8b-instant
ENV GROQ_MAX_TOKENS=500
ENV GROQ_TEMPERATURE=0.7
ENV CHROMADB_PATH=/app/chroma_data
ENV API_HOST=0.0.0.0
ENV API_PORT=7860
ENV MAX_MESSAGE_LENGTH=5000
ENV MAX_TURNS=20
ENV SESSION_TTL=3600
ENV SCAM_THRESHOLD=0.7
ENV RATE_LIMIT_PER_MINUTE=100
ENV RATE_LIMIT_PER_HOUR=1000
ENV INDICBERT_MODEL=ai4bharat/indic-bert
ENV SPACY_MODEL=en_core_web_sm
ENV EMBEDDING_MODEL=all-MiniLM-L6-v2
ENV GUVI_CALLBACK_URL=https://hackathon.guvi.in/api/updateHoneyPotFinalResult
ENV GUVI_CALLBACK_ENABLED=true

# Hugging Face Spaces requires port 7860
EXPOSE 7860

# Run the application on port 7860 (required by Hugging Face Spaces)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]