File size: 1,063 Bytes
dbcb30f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
34
35
36
37
38
import streamlit as st
import pickle
import pandas as pd
from prophet import Prophet
from prophet.plot import plot_plotly, plot_components

# Modeli yükleme fonksiyonu
def load_model():
    with open('prophet_model.pkl', 'rb') as f:
        model = pickle.load(f)
    return model

# Streamlit uygulaması
st.title("Hava Durumu Tahmini - Prophet Modeli")

# Modeli yükle
model = load_model()

# Kullanıcıdan tarih aralığı girişi
periods = st.number_input("Gelecek gün sayısını girin:", min_value=1, max_value=365, value=30)

# Gelecek verileri oluştur
future = model.make_future_dataframe(periods=periods)
predictions = model.predict(future)

# Tahminleri göster
st.subheader("Tahmin Sonuçları")
st.write(predictions[['ds', 'yhat', 'yhat_lower', 'yhat_upper']])

# Tahmin sonuçlarını çiz
st.subheader("Tahmin Grafiği")
fig = plot_plotly(model, predictions)
st.plotly_chart(fig)

# Bileşen grafiğini çiz (matplotlib kullanarak)
st.subheader("Bileşen Grafiği")
components_fig = plot_components(model, predictions)
st.pyplot(components_fig)