Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import base64
|
2 |
+
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
from pathlib import Path
|
5 |
+
|
6 |
+
# Settings
|
7 |
+
st.set_page_config(
|
8 |
+
page_title="Save your time!",
|
9 |
+
layout="wide",
|
10 |
+
initial_sidebar_state="expanded",
|
11 |
+
)
|
12 |
+
|
13 |
+
|
14 |
+
st.write("# Insira os dados")
|
15 |
+
|
16 |
+
# Colunas
|
17 |
+
col1, col2 = st.columns(2)
|
18 |
+
temp_instagram = col1.number_input("Horas por semana no Instagram", min_value=0, max_value=24)
|
19 |
+
temp_youtube = col2.number_input("Horas por semana no YouTube", min_value=0, max_value=24)
|
20 |
+
|
21 |
+
# Math
|
22 |
+
per_month = (temp_instagram + temp_youtube) * 4
|
23 |
+
per_year = (temp_instagram + temp_youtube) * 52
|
24 |
+
|
25 |
+
# Display
|
26 |
+
st.write("## Tempo Total")
|
27 |
+
col1, col2, col3 = st.columns(3)
|
28 |
+
col1.metric(label="Tempo gasto com redes sociais por mês", value=f"{per_month} horas")
|
29 |
+
col2.metric(label="Tempo gasto com redes sociais por ano", value=f"{per_year} horas")
|
30 |
+
|
31 |
+
df = {
|
32 |
+
|
33 |
+
"Anos da sua vida":80,
|
34 |
+
"Tempo restante de vida": 80 - (per_year * 80/8760),
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
data = pd.DataFrame(df, index=["Anos"])
|
39 |
+
st.bar_chart(data["Tempo restante de vida"])
|
40 |
+
|
41 |
+
|