monkseal555 commited on
Commit
a1d298e
·
verified ·
1 Parent(s): d07ca4f

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +16 -8
  2. README.md +19 -45
Dockerfile CHANGED
@@ -1,27 +1,35 @@
1
  FROM python:3.10-slim
2
 
3
- WORKDIR /app
 
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 -r requirements.txt
 
15
 
16
  # Copy application code
17
- COPY app.py .
18
 
19
  # Expose Streamlit port
20
  EXPOSE 7860
21
 
22
- # Set environment variables
23
- ENV STREAMLIT_SERVER_PORT=7860
24
- ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
25
 
26
  # Run Streamlit
27
- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
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: green
6
- sdk: gradio
7
- sdk_version: 4.44.0
8
- app_file: app.py
9
  pinned: false
10
  license: mit
11
  ---
12
 
13
- # WeatherFlow Flow Matching Model Training
14
 
15
- This Space provides GPU-accelerated training for flow matching models used in weather prediction.
16
 
17
  ## Features
18
 
19
- - **Real PyTorch Training**: Train actual flow matching models with GPU acceleration
20
- - **Physics-Informed Constraints**: Optional divergence and energy conservation losses
21
- - **Attention Mechanisms**: Multi-head attention for capturing spatial dependencies
22
- - **Model Upload**: Automatically uploads trained models to Hugging Face Hub
23
- - **Progress Tracking**: Real-time training progress and metrics
24
 
25
- ## Usage
26
 
27
- 1. Configure your experiment parameters
28
- 2. Enter your Hugging Face token (with write access)
29
- 3. Click "Start Training"
30
- 4. Wait for training to complete
31
- 5. Find your trained model in your Hugging Face Hub
 
32
 
33
- ## API Usage
34
-
35
- You can also call this Space programmatically:
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