Anigor66 commited on
Commit
6a97b56
·
1 Parent(s): 0b51359

Fixed Supabase

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -22,8 +22,10 @@ from huggingface_hub import hf_hub_download
22
  try:
23
  from supabase import create_client, Client
24
  SUPABASE_AVAILABLE = True
 
25
  except ImportError:
26
  SUPABASE_AVAILABLE = False
 
27
  print("⚠️ Supabase not available. Embedding storage/retrieval will be disabled.")
28
 
29
  # Import SAM components
@@ -71,7 +73,7 @@ print(f"Loading SAM model ({MODEL_TYPE}) from downloaded checkpoint...")
71
  try:
72
  # Ensure we always load onto CPU when no GPU is available
73
  torch.load = patched_torch_load
74
- sam = sam_model_registry[MODEL_TYPE](checkpoint=MODEL_CHECKPOINT)
75
  finally:
76
  torch.load = original_torch_load
77
 
@@ -103,7 +105,7 @@ print("✓ SAM model loaded successfully from HuggingFace Hub!")
103
  # -----------------------------------------------------------------------------
104
  # Supabase setup (for embedding storage/retrieval)
105
  # -----------------------------------------------------------------------------
106
- supabase: Client = None
107
  EMBED_BUCKET = "embeddings"
108
  EMBED_TABLE = "embeddings2"
109
 
 
22
  try:
23
  from supabase import create_client, Client
24
  SUPABASE_AVAILABLE = True
25
+ SupabaseClientType = Client
26
  except ImportError:
27
  SUPABASE_AVAILABLE = False
28
+ SupabaseClientType = None # Type placeholder when Supabase not available
29
  print("⚠️ Supabase not available. Embedding storage/retrieval will be disabled.")
30
 
31
  # Import SAM components
 
73
  try:
74
  # Ensure we always load onto CPU when no GPU is available
75
  torch.load = patched_torch_load
76
+ sam = sam_model_registry[MODEL_TYPE](checkpoint=MODEL_CHECKPOINT)
77
  finally:
78
  torch.load = original_torch_load
79
 
 
105
  # -----------------------------------------------------------------------------
106
  # Supabase setup (for embedding storage/retrieval)
107
  # -----------------------------------------------------------------------------
108
+ supabase = None # Will be set to Supabase Client if available
109
  EMBED_BUCKET = "embeddings"
110
  EMBED_TABLE = "embeddings2"
111