Spaces:
Sleeping
Sleeping
Jialun He
commited on
Commit
Β·
9e0693b
1
Parent(s):
733b76c
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
""" Basic Agent Evaluation Runner"""
|
2 |
import os
|
|
|
|
|
3 |
import inspect
|
4 |
import gradio as gr
|
5 |
import requests
|
@@ -198,12 +200,32 @@ with gr.Blocks() as demo:
|
|
198 |
outputs=[status_output, results_table]
|
199 |
)
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
if __name__ == "__main__":
|
202 |
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
203 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|
204 |
space_host_startup = os.getenv("SPACE_HOST")
|
205 |
space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
|
206 |
-
|
|
|
207 |
if space_host_startup:
|
208 |
print(f"β
SPACE_HOST found: {space_host_startup}")
|
209 |
print(f" Runtime URL should be: https://{space_host_startup}.hf.space")
|
|
|
1 |
""" Basic Agent Evaluation Runner"""
|
2 |
import os
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
from supabase.client import create_client
|
5 |
import inspect
|
6 |
import gradio as gr
|
7 |
import requests
|
|
|
200 |
outputs=[status_output, results_table]
|
201 |
)
|
202 |
|
203 |
+
def test_supabase_connection():
|
204 |
+
load_dotenv()
|
205 |
+
|
206 |
+
try:
|
207 |
+
supabase = create_client(
|
208 |
+
os.environ.get("SUPABASE_URL"),
|
209 |
+
os.environ.get("SUPABASE_SERVICE_KEY")
|
210 |
+
)
|
211 |
+
|
212 |
+
# Test query
|
213 |
+
result = supabase.table('documents').select("*").limit(1).execute()
|
214 |
+
print(f"Connection successful! Retrieved {len(result.data)} documents.")
|
215 |
+
return True
|
216 |
+
|
217 |
+
except Exception as e:
|
218 |
+
print(f"Connection failed: {e}")
|
219 |
+
return False
|
220 |
+
|
221 |
+
|
222 |
if __name__ == "__main__":
|
223 |
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
224 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|
225 |
space_host_startup = os.getenv("SPACE_HOST")
|
226 |
space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
|
227 |
+
test_supabase_connection()
|
228 |
+
|
229 |
if space_host_startup:
|
230 |
print(f"β
SPACE_HOST found: {space_host_startup}")
|
231 |
print(f" Runtime URL should be: https://{space_host_startup}.hf.space")
|