Shazaaly
commited on
Commit
·
ea7ba48
1
Parent(s):
f69030e
docker and run.sh
Browse files- Dockerfile +16 -1
- README.md +2 -6
- run.sh +12 -0
Dockerfile
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY requirements.txt .
|
| 6 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
|
|
|
|
| 8 |
COPY . .
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use official lightweight Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV HF_HOME=/data
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Create Hugging Face hub directory
|
| 9 |
+
RUN mkdir -p /data/hub
|
| 10 |
+
|
| 11 |
+
# Set working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Install dependencies
|
| 15 |
COPY requirements.txt .
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
+
# Copy code
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
+
# Ensure run.sh is executable
|
| 22 |
+
RUN chmod +x run.sh
|
| 23 |
+
|
| 24 |
+
# Default command
|
| 25 |
+
CMD ["./run.sh"]
|
README.md
CHANGED
|
@@ -3,10 +3,6 @@ title: SYPLYD MARBERT API
|
|
| 3 |
emoji: 🌍
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
-
sdk:
|
| 7 |
-
app_file:
|
| 8 |
---
|
| 9 |
-
|
| 10 |
-
# SYPLYD MARBERT API Endpoint
|
| 11 |
-
|
| 12 |
-
This Space serves the `ShazaAly/syplyd-marbert-1` model via a FastAPI API.
|
|
|
|
| 3 |
emoji: 🌍
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_file: run.sh
|
| 8 |
---
|
|
|
|
|
|
|
|
|
|
|
|
run.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Set the Hugging Face home directory to the persistent /data folder
|
| 4 |
+
export HF_HOME=/data
|
| 5 |
+
|
| 6 |
+
# Create the directory that the transformers library will try to use.
|
| 7 |
+
# The -p flag ensures it doesn't fail if the directory already exists.
|
| 8 |
+
mkdir -p $HF_HOME/hub
|
| 9 |
+
|
| 10 |
+
# Now, start the FastAPI application
|
| 11 |
+
# Using exec means this script will be replaced by the uvicorn process, which is efficient.
|
| 12 |
+
exec uvicorn app:app --host 0.0.0.0 --port 7860
|