File size: 1,138 Bytes
4986f6d
b245237
 
 
4986f6d
 
 
f0ef2d9
b245237
4986f6d
 
5dad19d
 
4986f6d
 
 
 
b245237
4986f6d
 
 
b245237
4986f6d
 
 
 
b245237
1654acc
 
 
4986f6d
1654acc
b245237
 
 
 
 
 
 
 
 
 
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
40
41
42
43
import os
import json
import logging

from dotenv import load_dotenv
from mmdeploy_runtime import Detector
from supabase import create_client, Client
from firebase_admin import credentials, initialize_app, firestore
from neo4j import GraphDatabase


logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)


load_dotenv()

# LOAD MODEL
model_path = "./model"
detector = Detector(model_path=model_path, device_name="cpu", device_id=0)

# LOAD SUPABASE
url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
supabase: Client = create_client(url, key)

# LOAD FIREBASE ADMIN SDK
firebase_app = initialize_app(
    credential=credentials.Certificate(
        json.loads(os.environ.get("FIREBASE_CREDENTIALS"))
    )
)
db = firestore.client()

# LOAD NEO4J DB
URI = os.environ.get("NEO4J_URI")
AUTH = (os.environ.get("NEO4J_USERNAME"), os.environ.get("NEO4J_PASSWORD"))
driver = GraphDatabase.driver(URI, auth=AUTH)
driver.verify_connectivity()
driver.execute_query(
    "CREATE CONSTRAINT uid IF NOT EXISTS FOR (p:Person) REQUIRE p.uid IS UNIQUE"
)