Yashk-13's picture
Create app.py
59192a1 verified
raw
history blame contribute delete
686 Bytes
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()