Spaces:
Sleeping
Sleeping
viz
Browse files- app_streamlit.py +1 -12
- functions/figure.py +2 -9
app_streamlit.py
CHANGED
|
@@ -45,15 +45,4 @@ st.subheader('Unit: PM25 - particle matter of diameter < 2.5 micrometers')
|
|
| 45 |
|
| 46 |
# Plotting
|
| 47 |
fig = figure.plot(df)
|
| 48 |
-
st.plotly_chart(fig)
|
| 49 |
-
|
| 50 |
-
# Scheduling
|
| 51 |
-
|
| 52 |
-
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 53 |
-
def restart():
|
| 54 |
-
restart_space("Robzy/hgb-weather", token=HF_TOKEN)
|
| 55 |
-
|
| 56 |
-
time_start = datetime.now()
|
| 57 |
-
scheduler = BackgroundScheduler()
|
| 58 |
-
job = scheduler.add_job(restart, "interval", minutes=2)
|
| 59 |
-
scheduler.start()
|
|
|
|
| 45 |
|
| 46 |
# Plotting
|
| 47 |
fig = figure.plot(df)
|
| 48 |
+
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functions/figure.py
CHANGED
|
@@ -86,13 +86,6 @@ def plot(df, n=10):
|
|
| 86 |
|
| 87 |
# x range start BEFORE today
|
| 88 |
k = 4
|
| 89 |
-
# Get the screen dimensions
|
| 90 |
-
screen_width = st.get_option("browser.clientWidth")
|
| 91 |
-
screen_height = st.get_option("browser.clientHeight")
|
| 92 |
-
|
| 93 |
-
# Set the width and height to take up nearly the entire screen
|
| 94 |
-
fig_width = screen_width * 0.8
|
| 95 |
-
fig_height = screen_height * 0.65
|
| 96 |
|
| 97 |
fig.update_layout(
|
| 98 |
shapes=shapes, # Add the background rectangles
|
|
@@ -115,8 +108,8 @@ def plot(df, n=10):
|
|
| 115 |
range=[1, np.log10(500)] # Set y-axis range to be positive
|
| 116 |
),
|
| 117 |
autosize=True,
|
| 118 |
-
width=
|
| 119 |
-
height=
|
| 120 |
hoverlabel=dict(
|
| 121 |
font_size=20 # Increase hover label font size
|
| 122 |
)
|
|
|
|
| 86 |
|
| 87 |
# x range start BEFORE today
|
| 88 |
k = 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
fig.update_layout(
|
| 91 |
shapes=shapes, # Add the background rectangles
|
|
|
|
| 108 |
range=[1, np.log10(500)] # Set y-axis range to be positive
|
| 109 |
),
|
| 110 |
autosize=True,
|
| 111 |
+
width=2100,
|
| 112 |
+
height=900,
|
| 113 |
hoverlabel=dict(
|
| 114 |
font_size=20 # Increase hover label font size
|
| 115 |
)
|