Tim Luka Horstmann commited on
Commit
e47a0a3
·
1 Parent(s): 703cd97
Files changed (3) hide show
  1. Dockerfile +30 -23
  2. __pycache__/app.cpython-311.pyc +0 -0
  3. app.py +2 -2
Dockerfile CHANGED
@@ -1,37 +1,44 @@
1
  # Use an official Python runtime as a base image
2
  FROM python:3.10
3
 
 
 
 
 
 
 
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies for llama_cpp
8
- RUN apt-get update && apt-get install -y \
9
- gcc \
10
- g++ \
11
- libffi-dev \
12
- libgcc-s1 \
13
- libstdc++6 \
14
- libopenblas-dev \
15
- && rm -rf /var/lib/apt/lists/*
16
-
17
- # Set environment variables for cache
18
- ENV TRANSFORMERS_CACHE=/app/cache
19
- ENV HF_HOME=/app/cache
20
-
21
- # Create cache directory with write permissions
22
  RUN mkdir -p /app/cache && chmod -R 777 /app/cache
23
 
24
- # Copy and install requirements
25
  COPY requirements.txt .
26
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
27
 
28
- # Copy application files
29
- COPY app.py .
30
- COPY cv_embeddings.json .
31
- COPY cv_text.txt .
32
 
33
- # Expose port
34
  EXPOSE 7860
35
 
36
- # Run the application
37
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use an official Python runtime as a base image
2
  FROM python:3.10
3
 
4
+ # Set non-interactive for apt
5
+ ENV DEBIAN_FRONTEND=noninteractive \
6
+ # Rust toolchain dirs
7
+ RUSTUP_HOME=/root/.rustup \
8
+ CARGO_HOME=/root/.cargo \
9
+ PATH=/root/.cargo/bin:$PATH
10
+
11
  # Set working directory
12
  WORKDIR /app
13
 
14
+ # Install system dependencies, Rust, and build tools
15
+ RUN apt-get update && apt-get install -y --no-install-recommends \
16
+ build-essential cmake git curl wget ninja-build libgomp1 ca-certificates \
17
+ gcc g++ libffi-dev libgcc-s1 libstdc++6 libopenblas-dev \
18
+ && rm -rf /var/lib/apt/lists/* \
19
+ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
20
+ && rustup default stable
21
+
22
+ # Prepare cache directory
 
 
 
 
 
 
23
  RUN mkdir -p /app/cache && chmod -R 777 /app/cache
24
 
25
+ # Copy and install Python requirements (excluding llama-cpp-python)
26
  COPY requirements.txt .
27
+ RUN sed -i '/llama-cpp-python/d' requirements.txt \
28
+ && pip install --no-cache-dir -r requirements.txt
29
+
30
+ # Clone and build llama-cpp-python from source
31
+ RUN git clone --recurse-submodules https://github.com/abetlen/llama-cpp-python.git /tmp/llama-cpp-python \
32
+ && cd /tmp/llama-cpp-python \
33
+ # Force a CMake rebuild even if cached
34
+ && FORCE_CMAKE=1 pip install --no-cache-dir -e . \
35
+ && rm -rf /tmp/llama-cpp-python
36
 
37
+ # Copy application code and data
38
+ COPY app.py cv_embeddings.json cv_text.txt ./
 
 
39
 
40
+ # Expose the port your FastAPI app runs on
41
  EXPOSE 7860
42
 
43
+ # Launch
44
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
__pycache__/app.cpython-311.pyc ADDED
Binary file (18.2 kB). View file
 
app.py CHANGED
@@ -32,8 +32,8 @@ login(token=hf_token)
32
 
33
  # Models Configuration
34
  sentence_transformer_model = "all-MiniLM-L6-v2"
35
- repo_id = "bartowski/deepcogito_cogito-v1-preview-llama-3B-GGUF" # "bartowski/deepcogito_cogito-v1-preview-llama-8B-GGUF"
36
- filename = "deepcogito_cogito-v1-preview-llama-3B-Q4_K_M.gguf"
37
 
38
  # Define FAQs
39
  faqs = [
 
32
 
33
  # Models Configuration
34
  sentence_transformer_model = "all-MiniLM-L6-v2"
35
+ repo_id = "unsloth/Qwen3-1.7B-GGUF" # "bartowski/deepcogito_cogito-v1-preview-llama-3B-GGUF" # "bartowski/deepcogito_cogito-v1-preview-llama-8B-GGUF"
36
+ filename = "Qwen3-1.7B-Q4_K_M.gguf" # "deepcogito_cogito-v1-preview-llama-3B-Q4_K_M.gguf"
37
 
38
  # Define FAQs
39
  faqs = [