Upload folder using huggingface_hub
Browse files- Dockerfile +16 -8
- README.md +19 -45
Dockerfile
CHANGED
|
@@ -1,27 +1,35 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
git \
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Copy requirements first for caching
|
| 11 |
-
COPY requirements.txt .
|
| 12 |
|
| 13 |
# Install Python dependencies
|
| 14 |
-
RUN pip install --no-cache-dir -
|
|
|
|
| 15 |
|
| 16 |
# Copy application code
|
| 17 |
-
COPY app.py .
|
| 18 |
|
| 19 |
# Expose Streamlit port
|
| 20 |
EXPOSE 7860
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
| 25 |
|
| 26 |
# Run Streamlit
|
| 27 |
-
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
+
WORKDIR /home/user/app
|
| 5 |
|
| 6 |
# Install system dependencies
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
git \
|
| 9 |
+
curl \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Create non-root user for HF Spaces
|
| 13 |
+
RUN useradd -m -u 1000 user
|
| 14 |
+
USER user
|
| 15 |
+
ENV HOME=/home/user \
|
| 16 |
+
PATH=/home/user/.local/bin:$PATH
|
| 17 |
+
|
| 18 |
# Copy requirements first for caching
|
| 19 |
+
COPY --chown=user requirements.txt .
|
| 20 |
|
| 21 |
# Install Python dependencies
|
| 22 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 23 |
+
pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
# Copy application code
|
| 26 |
+
COPY --chown=user app.py .
|
| 27 |
|
| 28 |
# Expose Streamlit port
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
+
# Health check
|
| 32 |
+
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
|
|
|
|
| 33 |
|
| 34 |
# Run Streamlit
|
| 35 |
+
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
|
README.md
CHANGED
|
@@ -1,59 +1,33 @@
|
|
| 1 |
---
|
| 2 |
title: WeatherFlow Training
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version: 4.44.0
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# WeatherFlow
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
## Features
|
| 18 |
|
| 19 |
-
- **
|
| 20 |
-
- **
|
| 21 |
-
- **
|
| 22 |
-
- **Model Upload**: Automatically uploads trained models to Hugging Face Hub
|
| 23 |
-
- **Progress Tracking**: Real-time training progress and metrics
|
| 24 |
|
| 25 |
-
##
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
| 32 |
|
| 33 |
-
##
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
```python
|
| 38 |
-
from gradio_client import Client
|
| 39 |
-
|
| 40 |
-
client = Client("your-username/weatherflow-training")
|
| 41 |
-
result = client.predict(
|
| 42 |
-
experiment_name="My Experiment",
|
| 43 |
-
variables="z, t",
|
| 44 |
-
pressure_levels="500",
|
| 45 |
-
grid_lat=16,
|
| 46 |
-
grid_lon=32,
|
| 47 |
-
hidden_dim=96,
|
| 48 |
-
num_layers=3,
|
| 49 |
-
use_attention=True,
|
| 50 |
-
physics_informed=True,
|
| 51 |
-
epochs=50,
|
| 52 |
-
batch_size=8,
|
| 53 |
-
learning_rate=0.0005,
|
| 54 |
-
train_samples=64,
|
| 55 |
-
val_samples=16,
|
| 56 |
-
hf_token="your-token"
|
| 57 |
-
)
|
| 58 |
-
print(result)
|
| 59 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
title: WeatherFlow Training
|
| 3 |
+
emoji: 🌀
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: mit
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# WeatherFlow Training
|
| 12 |
|
| 13 |
+
Train flow matching models to predict wind fields from hurricane brightness temperature images.
|
| 14 |
|
| 15 |
## Features
|
| 16 |
|
| 17 |
+
- **Train Models**: Upload hurricane image pairs from Google Drive and train flow matching models
|
| 18 |
+
- **Run Inference**: Use trained models to predict wind fields from new hurricane images
|
| 19 |
+
- **Save to Hub**: Automatically save trained models to Hugging Face Hub
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
## How to Use
|
| 22 |
|
| 23 |
+
### Training
|
| 24 |
+
1. Prepare hurricane image pairs where left half = brightness temperature, right half = wind field
|
| 25 |
+
2. Upload images to a Google Drive folder and make it publicly accessible
|
| 26 |
+
3. Paste the Google Drive folder URL
|
| 27 |
+
4. Configure model parameters and click "Start Training"
|
| 28 |
+
5. The trained model will be saved to your Hugging Face Hub
|
| 29 |
|
| 30 |
+
### Inference
|
| 31 |
+
1. Enter the HF Hub repository ID of your trained model
|
| 32 |
+
2. Upload a hurricane brightness temperature image
|
| 33 |
+
3. Click "Run Inference" to generate the predicted wind field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|