Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| import plotly.express as px | |
| import joblib | |
| from prophet.plot import plot_plotly | |
| st.title("Daily Female Births Forecasting 🍼") | |
| # Modeli yükle | |
| model = joblib.load("src/daily_births_model.pkl") | |
| # Veri yükleme | |
| df = pd.read_csv('src/daily-total-female-births.csv') | |
| df['Date'] = pd.to_datetime(df['Date']) | |
| forecast = df.rename(columns={'Date': 'ds', 'Births': 'y'}) | |
| # Kullanıcıdan tahmin gün sayısı al | |
| days_to_forecast = st.number_input("Gelecek kaç günü tahmin etmek istersiniz?", min_value=1, max_value=365, value=30) | |
| # Gelecek tarihleri oluştur | |
| future = model.make_future_dataframe(periods=days_to_forecast) | |
| prediction = model.predict(future) | |
| st.subheader("Tahmin Grafiği") | |
| fig = plot_plotly(model, prediction) | |
| st.plotly_chart(fig, use_container_width=True) | |
| st.subheader("Tahmin Verisi") | |
| st.dataframe(prediction[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail(days_to_forecast)) |