Spaces:
Sleeping
Sleeping
Update data_loader.py
Browse files- data_loader.py +15 -13
data_loader.py
CHANGED
@@ -5,18 +5,20 @@ from supabase import create_client, Client
|
|
5 |
|
6 |
#Aqui van las credenciales, conectar las credenciales de Supabase en "Secrets"
|
7 |
|
8 |
-
|
9 |
-
#SUPABASE_KEY =
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
return pd.DataFrame()
|
18 |
-
else:
|
19 |
-
return pd.DataFrame(response.data)
|
20 |
-
except Exception as e:
|
21 |
-
st.error(f"An error occurred: {e}")
|
22 |
-
return pd.DataFrame()
|
|
|
5 |
|
6 |
#Aqui van las credenciales, conectar las credenciales de Supabase en "Secrets"
|
7 |
|
8 |
+
Class DataLoader():
|
|
|
9 |
|
10 |
+
#SUPABASE_URL =
|
11 |
+
#SUPABASE_KEY =
|
12 |
+
|
13 |
+
def load_data():
|
14 |
+
"""fertility, geo data, labor, population y predictions """
|
15 |
+
try:
|
16 |
+
response = supabase.from_("LabourForecast").execute()
|
17 |
+
if response.error:
|
18 |
+
st.error(f"Error fetching data: {response.error}")
|
19 |
+
return pd.DataFrame()
|
20 |
+
else:
|
21 |
+
return pd.DataFrame(response.data)
|
22 |
+
except Exception as e:
|
23 |
+
st.error(f"An error occurred: {e}")
|
24 |
return pd.DataFrame()
|
|
|
|
|
|
|
|
|
|