Spaces:
Paused
Paused
muhammadhamza-stack commited on
Commit ·
d08406f
1
Parent(s): 233a9c8
add dockerfile
Browse files- Dockerfile +31 -0
- app.py +4 -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"]
|
app.py
CHANGED
|
@@ -272,4 +272,7 @@ with gr.Blocks(title="MoS2 Image Segmentation") as demo:
|
|
| 272 |
|
| 273 |
|
| 274 |
if __name__ == "__main__":
|
| 275 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
|
| 273 |
|
| 274 |
if __name__ == "__main__":
|
| 275 |
+
demo.launch(
|
| 276 |
+
server_name="0.0.0.0",
|
| 277 |
+
server_port=7860
|
| 278 |
+
)
|