basel-weather / app.py
jonwiese
init
13d2dd0
raw
history blame
810 Bytes
import gradio as gr
from train import WeatherPredictor
# Initialize the predictor
predictor = WeatherPredictor('basel-weather.csv')
predictor.load_model('weather_predictor.pth')
@spaces.GPU
def predict_weather(input_date):
result = predictor.predict(input_date)
return result['temp'], result['precip'], result['snow'], result['windspeed']
# Create Gradio interface
app = gr.Interface(
fn=predict_weather,
inputs=gr.Textbox(label="Enter Date (dd/mm/yy)"),
outputs=[
gr.Textbox(label="Temperature"),
gr.Textbox(label="Precipitation"),
gr.Textbox(label="Snow"),
gr.Textbox(label="Windspeed")
],
title="Weather Predictor",
description="Enter a date to get weather predictions."
)
# Launch the interface
if __name__ == "__main__":
app.launch()