Spaces:
Runtime error
Runtime error
Fix Dockerfile and README: update MODEL_ID to google/gemma-3n-E4B-it and optimize environment variables
Browse files- Dockerfile +6 -7
- README.md +12 -10
Dockerfile
CHANGED
|
@@ -35,15 +35,14 @@ COPY . /app/
|
|
| 35 |
# Créer les dossiers cache et donner les droits d'écriture
|
| 36 |
RUN mkdir -p /app/cache/huggingface /tmp/hf_cache /tmp/model_offload && \
|
| 37 |
chmod -R 777 /app/cache/huggingface /tmp/hf_cache /tmp/model_offload
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
ENV
|
| 42 |
-
ENV
|
| 43 |
-
ENV MODEL_ID=google/gemma-3n-
|
| 44 |
ENV DEVICE_MAP=cpu
|
| 45 |
ENV MAX_NEW_TOKENS=256
|
| 46 |
-
ENV PYTHONPATH=/app/src
|
| 47 |
|
| 48 |
# Health check
|
| 49 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
|
|
| 35 |
# Créer les dossiers cache et donner les droits d'écriture
|
| 36 |
RUN mkdir -p /app/cache/huggingface /tmp/hf_cache /tmp/model_offload && \
|
| 37 |
chmod -R 777 /app/cache/huggingface /tmp/hf_cache /tmp/model_offload
|
| 38 |
+
# Set environment variables
|
| 39 |
+
ENV PYTHONPATH=/app
|
| 40 |
+
ENV HF_HOME=/tmp/hf_home
|
| 41 |
+
ENV TRANSFORMERS_CACHE=/tmp/hf_home/transformers
|
| 42 |
+
ENV HF_HUB_ENABLE_HF_TRANSFER=0
|
| 43 |
+
ENV MODEL_ID=google/gemma-3n-E4B-it
|
| 44 |
ENV DEVICE_MAP=cpu
|
| 45 |
ENV MAX_NEW_TOKENS=256
|
|
|
|
| 46 |
|
| 47 |
# Health check
|
| 48 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
README.md
CHANGED
|
@@ -54,16 +54,18 @@ curl -X POST \
|
|
| 54 |
https://huggingface.co/spaces/sido1991/apiagrilens/diagnose
|
| 55 |
```
|
| 56 |
|
| 57 |
-
##
|
| 58 |
|
| 59 |
-
|
| 60 |
-
- **Type**: Image-to-Text
|
| 61 |
-
- **Purpose**: Plant disease diagnosis
|
| 62 |
-
- **Language**: French responses
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
- `
|
| 69 |
-
- `
|
|
|
|
|
|
|
|
|
| 54 |
https://huggingface.co/spaces/sido1991/apiagrilens/diagnose
|
| 55 |
```
|
| 56 |
|
| 57 |
+
## Configuration
|
| 58 |
|
| 59 |
+
### Variables d'environnement
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
+
- **Model**: google/gemma-3n-E4B-it
|
| 62 |
+
- **Device**: CPU (optimisé pour Hugging Face Spaces)
|
| 63 |
+
- **Max Tokens**: 256
|
| 64 |
+
- **Cache Directory**: /tmp/hf_home
|
| 65 |
|
| 66 |
+
### Variables configurables
|
| 67 |
+
|
| 68 |
+
- `MODEL_ID`: Model identifier (default: google/gemma-3n-E4B-it)
|
| 69 |
+
- `DEVICE_MAP`: Device mapping (default: cpu)
|
| 70 |
+
- `MAX_NEW_TOKENS`: Maximum new tokens for generation (default: 256)
|
| 71 |
+
- `HF_HOME`: Hugging Face cache directory (default: /tmp/hf_home)
|