tested loading images from minio
This commit is contained in:
@@ -1,22 +1,32 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
from shared.data_store import (
|
||||||
|
connect as connect_minio,
|
||||||
|
)
|
||||||
from shared.database import connect
|
from shared.database import connect
|
||||||
from shared.database import get_visual_communication
|
from shared.database import get_visual_communication
|
||||||
|
from shared.utils import check_env
|
||||||
|
from shared.utils import setup_logging
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# prepare env vars
|
# load in env file
|
||||||
env_path = Path(__file__).parent.parent / 'local.env'
|
env_path = Path(__file__).parent.parent / 'server.env'
|
||||||
assert env_path.exists()
|
assert env_path.exists()
|
||||||
load_dotenv(env_path)
|
load_dotenv(env_path)
|
||||||
os.environ['MONGO_HOST'] = 'localhost'
|
# ensure env vars set
|
||||||
# connect to database
|
check_env()
|
||||||
|
# setup logging
|
||||||
|
setup_logging()
|
||||||
|
# connect to minIO
|
||||||
|
minio_client = connect_minio()
|
||||||
|
# connect to MongoDB
|
||||||
collection, db, client = connect()
|
collection, db, client = connect()
|
||||||
print(client.server_info())
|
|
||||||
# get visual communication
|
# get visual communication
|
||||||
vis_com = get_visual_communication(collection)
|
vis_com = get_visual_communication(collection)
|
||||||
print(vis_com)
|
print(repr(vis_com))
|
||||||
|
image = vis_com.get_image(minio_client=minio_client)
|
||||||
|
image.show()
|
||||||
|
|||||||
Reference in New Issue
Block a user