-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathStreamlitApp.py
33 lines (25 loc) · 1.06 KB
/
StreamlitApp.py
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
from supabase import create_client
import pandas as pd
import streamlit as st
import plotly.express as px
API_URL = 'API_URL'
API_KEY = 'API_KEY'
supabase = create_client(API_URL, API_KEY)
supabaseList = supabase.table('maintable').select('*').execute().data
df = pd.DataFrame()
for row in supabaseList:
row["created_at"] = row["created_at"].split(".")[0]
row["time"] = row["created_at"].split("T")[1]
row["date"] = row["created_at"].split("T")[0]
row["DateTime"] = row["created_at"]
df = df.append(row, ignore_index=True)
st.set_page_config(page_title="Dashboard",layout='centered', initial_sidebar_state='collapsed')
st.markdown('### Temperature')
fig = px.line(df, x="DateTime", y="temperature", title='',markers=True)
st.plotly_chart(fig,use_container_width=True)
st.markdown('### Humidity')
fig = px.line(df, x="DateTime", y="humidity", title='',markers=True)
st.plotly_chart(fig,use_container_width=True)
st.markdown('### Moisture')
fig = px.line(df, x="DateTime", y="moisture", title='',markers=True)
st.plotly_chart(fig,use_container_width=True)