Spaces:
Sleeping
Sleeping
File size: 1,015 Bytes
01242e9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import os
from supabase import create_client
from dotenv import load_dotenv
load_dotenv()
# Initialize Supabase
url = os.environ.get("SUPABASE_URL")
# using Service Role Key to bypass RLS if needed, or simple ANON key if policy allows
key = os.environ.get("SUPABASE_SERVICE_ROLE_KEY") or os.environ.get("SUPABASE_KEY")
if not url or not key:
print("Error: Supabase credentials not found in environment.")
exit(1)
supabase = create_client(url, key)
model_data = {
"name": "Production Model (Initial)",
"version": "v1.0.0",
"status": "ready",
"metrics": {
"accuracy": 0.998,
"precision": 0.908,
"recall": 1.00,
"f1": 0.952,
"specificity": 0.998
},
"file_path": "Models/fraud_pipeline_final.pkl",
"is_active": True
}
try:
data = supabase.table("model_registry").insert(model_data).execute()
print("Successfully registered existing model:")
print(data.data)
except Exception as e:
print(f"Failed to register model: {e}")
|