jonwiese commited on
Commit
13d2dd0
1 Parent(s): 3c18678
Files changed (3) hide show
  1. app.py +29 -0
  2. requirements.txt +5 -0
  3. weather_predictor.pth +3 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from train import WeatherPredictor
3
+
4
+ # Initialize the predictor
5
+ predictor = WeatherPredictor('basel-weather.csv')
6
+ predictor.load_model('weather_predictor.pth')
7
+
8
+ @spaces.GPU
9
+ def predict_weather(input_date):
10
+ result = predictor.predict(input_date)
11
+ return result['temp'], result['precip'], result['snow'], result['windspeed']
12
+
13
+ # Create Gradio interface
14
+ app = gr.Interface(
15
+ fn=predict_weather,
16
+ inputs=gr.Textbox(label="Enter Date (dd/mm/yy)"),
17
+ outputs=[
18
+ gr.Textbox(label="Temperature"),
19
+ gr.Textbox(label="Precipitation"),
20
+ gr.Textbox(label="Snow"),
21
+ gr.Textbox(label="Windspeed")
22
+ ],
23
+ title="Weather Predictor",
24
+ description="Enter a date to get weather predictions."
25
+ )
26
+
27
+ # Launch the interface
28
+ if __name__ == "__main__":
29
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ pandas==2.1.4
2
+ scikit-learn==1.3.2
3
+ numpy==1.26.2
4
+ gradio
5
+ torch==2.1.2
weather_predictor.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c67235436c311635e3c066447935a1b1a7cb3904628f5a8299eb82d24dc298d2
3
+ size 3756