Files
visual_critical_discourse_a…/misc/get_visual_communication.py
T
brian aff0ae8fc6
Code Quality Pipeline / Check Code (pull_request) Successful in 3m15s
fixed types
2025-01-06 13:42:21 +00:00

32 lines
946 B
Python

from __future__ import annotations
from pathlib import Path
from dotenv import load_dotenv
from shared.datastore import Datastore
from shared.mongodb import connect_mongodb, get_visual_communication
from shared.utils import check_env, setup_logging
from web_ui.src.main import NECESSARY_ENV_VAR_LIST
if __name__ == '__main__':
# load in env file
env_path = Path(__file__).parent.parent / 'server.env'
assert env_path.exists()
load_dotenv(env_path)
# ensure env vars set
check_env(NECESSARY_ENV_VAR_LIST)
# setup logging
setup_logging()
# connect to minIO
datastore = Datastore()
datastore.connect()
assert datastore._client is not None
# connect to MongoDB
collection, db, client = connect_mongodb()
# get visual communication
vis_com = get_visual_communication(collection)
print(repr(vis_com))
image = vis_com.get_image(minio_client=datastore._client)
image.show()