FinSightAI / backend /models /modal_client.py
Aniket2003333333's picture
start
7248d39
Raw
History Blame Contribute Delete
652 Bytes
"""Modal remote class lookups for FinSight AI inference."""
import modal
from config import settings
_embedder_cls = None
_llm_cls = None
_ocr_cls = None
def get_embedder():
global _embedder_cls
if _embedder_cls is None:
_embedder_cls = modal.Cls.from_name(settings.MODAL_APP_NAME, "Embedder")
return _embedder_cls()
def get_llm():
global _llm_cls
if _llm_cls is None:
_llm_cls = modal.Cls.from_name(settings.MODAL_APP_NAME, "LLM")
return _llm_cls()
def get_ocr():
global _ocr_cls
if _ocr_cls is None:
_ocr_cls = modal.Cls.from_name(settings.MODAL_APP_NAME, "OCR")
return _ocr_cls()