-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
63 lines (46 loc) · 1.86 KB
/
main.py
File metadata and controls
63 lines (46 loc) · 1.86 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import streamlit as st
from datetime import date
from plotly import graph_objs as go
import pandas as pd
st.set_page_config(page_title="File Uploader")
def plot_data(column,alarm=None,alert=None):
fig = go.Figure()
fig.add_trace(go.Scatter(
x=df['value_created_at'], y=df[column],
mode='lines',
name=column
))
fig.layout.update(title_text="Time series data", xaxis_rangeslider_visible=True)
if alarm or alert :
fig.add_hline(y=alert, line=dict(color="yellow" , width=2 , dash ="solid"))
fig.add_hline(y=alarm, line=dict(color="Red" , width=2 , dash ="solid"))
st.plotly_chart(fig)
st.title("Change Point detection And Forecasting Dashbord")
df = st.file_uploader(label = "Upload your dataset: ")
if df :
df = pd.read_csv(df)
df['value_created_at'] = pd.to_datetime(df['value_created_at'])
st.write(df.head(5))
metric = st.sidebar.text_input('Choose column to plot')
if metric :
if metric in ('NGA','NGV') :
alarm = st.sidebar.text_input('Treshold alarm')
alert = st.sidebar.text_input('Treshold alert')
plot_data(metric,alarm,alert)
else :
plot_data(metric)
# TODAY = date.today().strftime("%Y-%m-%d")
# period = st.slider("period of prediction: ",1,30*24)
forcasting, AOD = st.tabs(["Forcasting" , "AOD"])
with forcasting :
st.header('Forcasting')
date = ('Hour','Days' , 'months')
selected_date = st.selectbox("Select Date : ",date)
if selected_date == 'Hour' :
period = st.slider("Period of prediction in hours: ",1,12)
if selected_date == 'Days' :
period = st.slider("Period of prediction in days: ",1,15)
if selected_date == 'months' :
period = st.slider("Period of prediction in months: ",1,5)
with AOD :
st.header('AOD')