-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_bd.py
44 lines (37 loc) · 1.1 KB
/
create_bd.py
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
44
import os
import weaviate
from dotenv import load_dotenv
load_dotenv()
WEAVIATE_URL = os.environ.get("WEAVIATE_URL")
WEAVIATE_API_KEY = os.environ.get("WEAVIATE_API_KEY")
if __name__ == "__main__":
client = weaviate.Client(
url=WEAVIATE_URL,
auth_client_secret=weaviate.AuthApiKey(api_key=WEAVIATE_API_KEY),
)
if client.schema.exists("Animals"):
client.schema.delete_class("Animals")
class_obj = {
"class": "Animals",
"description": "Images of different animals",
"vectorizer": "none",
"properties": [
{
"name": "label",
"dataType": ["string"],
"description": "name of animal",
},
{
"name": "image",
"dataType": ["blob"],
"description": "image",
},
{
"name": "filepath",
"dataType": ["string"],
"description": "filepath of the images",
},
],
}
client.schema.create_class(class_obj)
print(client.schema.get())