Spaces:
Sleeping
Sleeping
Update app.py
Browse filesTesting connection to supabase
app.py
CHANGED
@@ -58,7 +58,7 @@ def load_data():
|
|
58 |
return pd.DataFrame()
|
59 |
|
60 |
|
61 |
-
|
62 |
# Pendiente las Keys, dependiendo del modelo que escojamos
|
63 |
|
64 |
model_name = "google/flan-t5-small" # Probando modelos
|
@@ -72,19 +72,12 @@ generate_button = st.button("Generate")
|
|
72 |
|
73 |
if generate_button and user_input:
|
74 |
|
75 |
-
if
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
else:
|
79 |
-
|
80 |
-
|
81 |
-
response = supabase.table("LabourForecast").select("*").limit(1).execute()
|
82 |
-
|
83 |
-
if response.error:
|
84 |
-
print(f"Supabase connection test failed with error: {response.error}")
|
85 |
-
else:
|
86 |
-
print("Supabase connection test successful!")
|
87 |
-
print("First row from 'your_test_table':", response.data)
|
88 |
-
|
89 |
-
except Exception as e:
|
90 |
-
print(f"An unexpected error occurred during Supabase connection test: {e}")
|
|
|
58 |
return pd.DataFrame()
|
59 |
|
60 |
|
61 |
+
data = load_data()
|
62 |
# Pendiente las Keys, dependiendo del modelo que escojamos
|
63 |
|
64 |
model_name = "google/flan-t5-small" # Probando modelos
|
|
|
72 |
|
73 |
if generate_button and user_input:
|
74 |
|
75 |
+
if data.empty and supabase is not None:
|
76 |
+
st.warning("Successfully connected to Supabase, but no data was loaded (either the table is empty or there was a query issue). Check the error message above if any.")
|
77 |
+
elif not data.empty:
|
78 |
+
st.success("Successfully connected to Supabase and loaded data!")
|
79 |
+
st.dataframe(data.head()) # Display a small sample of the data
|
80 |
+
elif supabase is None:
|
81 |
+
st.error("Failed to initialize Supabase client. Check environment variables in Settings.")
|
82 |
else:
|
83 |
+
st.info("Attempted to load data. Check for any error messages above.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|