File size: 686 Bytes
59192a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
from inference import run_forecast
from data_fetcher import download_era5
import os

def forecast_cyclone(date):
    input_path = f"{date}.nc"
    download_era5(date, input_path)
    output = run_forecast(input_path)
    
    # Do post-processing here (plot wind, detect cyclone)
    fig_path = "forecast.png"
    output["t2m"].isel(time=0).plot()  # example temp plot
    import matplotlib.pyplot as plt
    plt.savefig(fig_path)
    
    return fig_path

gr.Interface(
    fn=forecast_cyclone,
    inputs=["text"],
    outputs="image",
    title="Cyclone Forecast (AIFS Model)",
    description="Select date (YYYY-MM-DD) to generate forecast for India"
).launch()