move_images_to_minio #44
@@ -1,22 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from shared.data_store import (
|
||||
connect as connect_minio,
|
||||
)
|
||||
from shared.database import connect
|
||||
from shared.database import get_visual_communication
|
||||
from shared.utils import check_env
|
||||
from shared.utils import setup_logging
|
||||
|
||||
if __name__ == '__main__':
|
||||
# prepare env vars
|
||||
env_path = Path(__file__).parent.parent / 'local.env'
|
||||
# load in env file
|
||||
env_path = Path(__file__).parent.parent / 'server.env'
|
||||
assert env_path.exists()
|
||||
load_dotenv(env_path)
|
||||
os.environ['MONGO_HOST'] = 'localhost'
|
||||
# connect to database
|
||||
# ensure env vars set
|
||||
check_env()
|
||||
# setup logging
|
||||
setup_logging()
|
||||
# connect to minIO
|
||||
minio_client = connect_minio()
|
||||
# connect to MongoDB
|
||||
collection, db, client = connect()
|
||||
print(client.server_info())
|
||||
# get visual communication
|
||||
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