Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +37 -0
- requirements.txt +10 -0
- sarimax_model.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import joblib
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import statsmodels.api as sm
|
| 5 |
+
|
| 6 |
+
# Modeli yükle
|
| 7 |
+
model = joblib.load('sarimax_model.pkl')
|
| 8 |
+
|
| 9 |
+
# Verilerinizi yükleyin (tarih sütunu adını doğru bir şekilde değiştirin)
|
| 10 |
+
data = pd.read_csv('Thecleverprogrammer.csv', parse_dates=['Date'], index_col='Date')
|
| 11 |
+
|
| 12 |
+
# Modelin özetini göster
|
| 13 |
+
st.title('SARIMAX Model Özeti')
|
| 14 |
+
st.write(model.summary())
|
| 15 |
+
|
| 16 |
+
# Tahmin yapmak için bir fonksiyon oluşturun
|
| 17 |
+
def predict_views(model, data, steps=5):
|
| 18 |
+
last_date = data.index[-1] # Son tarih
|
| 19 |
+
print("Last Date:", last_date) # Hata ayıklama için
|
| 20 |
+
print("Type of Last Date:", type(last_date)) # Hata ayıklama için
|
| 21 |
+
|
| 22 |
+
# Son tarihi doğru bir şekilde kullan
|
| 23 |
+
future_dates = pd.date_range(start=last_date + pd.Timedelta(days=1), periods=steps)
|
| 24 |
+
|
| 25 |
+
# Tahminleri yap
|
| 26 |
+
forecast = model.get_forecast(steps=steps)
|
| 27 |
+
predicted_mean = forecast.predicted_mean
|
| 28 |
+
return future_dates, predicted_mean
|
| 29 |
+
|
| 30 |
+
# Streamlit UI
|
| 31 |
+
steps = st.number_input('Tahmin edilecek adım sayısı', min_value=1, max_value=30, value=5)
|
| 32 |
+
|
| 33 |
+
if st.button('Tahmin Et'):
|
| 34 |
+
future_dates, predictions = predict_views(model, data, steps)
|
| 35 |
+
st.write('Tahmin Edilen Görüntü Sayısı:')
|
| 36 |
+
for date, prediction in zip(future_dates, predictions):
|
| 37 |
+
st.write(f"{date.date()}: {prediction:.2f}")
|
requirements.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
tensorflow
|
| 3 |
+
opencv-python
|
| 4 |
+
scikit-learn
|
| 5 |
+
torch
|
| 6 |
+
torchvision
|
| 7 |
+
matplotlib
|
| 8 |
+
transformers
|
| 9 |
+
sentencepiece
|
| 10 |
+
plotly
|
sarimax_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f2cc09a5ea6feb0981ce399c6ccad82ed7f4bec0a22120f16f5a02827adcf155
|
| 3 |
+
size 448892100
|