muhammadhamza-stack commited on
Commit
10b2c2b
·
1 Parent(s): eb6195b

dockerize the app

Browse files
Files changed (4) hide show
  1. Dockerfile +31 -0
  2. README.md +1 -1
  3. app.py +5 -1
  4. runtime.txt +0 -1
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HF Spaces compatible base image
2
+ FROM python:3.9-slim
3
+
4
+ # Prevent Python from writing .pyc files
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ # Set working directory
9
+ WORKDIR /app
10
+
11
+ # System dependencies (safe defaults)
12
+ RUN apt-get update && apt-get install -y \
13
+ git \
14
+ curl \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Copy requirements first (better Docker caching)
18
+ COPY requirements.txt .
19
+
20
+ # Upgrade pip and install dependencies
21
+ RUN pip install --upgrade pip \
22
+ && pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy the rest of the application
25
+ COPY . .
26
+
27
+ # Hugging Face Spaces uses port 7860
28
+ EXPOSE 7860
29
+
30
+ # Start the app
31
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -3,7 +3,7 @@ title: Coin Detection
3
  emoji: 📊
4
  colorFrom: purple
5
  colorTo: blue
6
- sdk: gradio
7
  sdk_version: 5.11.0
8
  app_file: app.py
9
  pinned: false
 
3
  emoji: 📊
4
  colorFrom: purple
5
  colorTo: blue
6
+ sdk: docker
7
  sdk_version: 5.11.0
8
  app_file: app.py
9
  pinned: false
app.py CHANGED
@@ -234,4 +234,8 @@ with gr.Blocks(title="Coin Detector") as iface:
234
 
235
  # Launch the Gradio interface
236
  iface.queue()
237
- iface.launch(share=True)
 
 
 
 
 
234
 
235
  # Launch the Gradio interface
236
  iface.queue()
237
+ iface.launch(
238
+ server_name="0.0.0.0",
239
+ server_port=7860,
240
+ share=True
241
+ )
runtime.txt DELETED
@@ -1 +0,0 @@
1
- Python-3.10