DIVYANSHI SINGH commited on
Commit
4c1fc4e
·
1 Parent(s): 008e1fb

Add Dockerfile for Hugging Face deployment and update README frontmatter

Browse files
Files changed (2) hide show
  1. Dockerfile +31 -0
  2. README.md +1 -1
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python 3.10 slim image
2
+ FROM python:3.10-slim
3
+
4
+ # Create a user to avoid running as root (required by Hugging Face Spaces security guidelines)
5
+ RUN useradd -m -u 1000 user
6
+ ENV HOME=/home/user \
7
+ PATH=/home/user/.local/bin:$PATH
8
+
9
+ WORKDIR $HOME/app
10
+
11
+ # Install system libraries necessary for OpenCV and EasyOCR
12
+ RUN apt-get update && apt-get install -y \
13
+ libgl1 \
14
+ libglib2.0-0 \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Copy the requirements file into the container
18
+ COPY --chown=user requirements.txt .
19
+
20
+ # Install dependencies (running as the new user)
21
+ USER user
22
+ RUN pip install --no-cache-dir --user -r requirements.txt
23
+
24
+ # Copy the rest of the application code
25
+ COPY --chown=user . .
26
+
27
+ # Expose port 7860 (Hugging Face Spaces default for Docker)
28
+ EXPOSE 7860
29
+
30
+ # Command to run the application
31
+ CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
README.md CHANGED
@@ -3,7 +3,7 @@ title: Bill Invoice Scanner Pro
3
  emoji: 🧾
4
  colorFrom: blue
5
  colorTo: indigo
6
- sdk: streamlit
7
  sdk_version: 1.42.0
8
  app_file: app.py
9
  pinned: false
 
3
  emoji: 🧾
4
  colorFrom: blue
5
  colorTo: indigo
6
+ sdk: docker
7
  sdk_version: 1.42.0
8
  app_file: app.py
9
  pinned: false