juancamval commited on
Commit
0cc8534
·
verified ·
1 Parent(s): f5e3584

Update app.py

Browse files

Testing connection to supabase

Files changed (1) hide show
  1. app.py +9 -16
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 not SUPABASE_URL or not SUPABASE_KEY:
76
- print("Error: Supabase URL and/or Key not found in environment variables.")
77
-
 
 
 
 
78
  else:
79
- try:
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.")