CoolFace
Apppublic

nvtitan/graphRAG

sourceHugging Facemitupdated 10mo agoView on Hugging Face
0likes
modal_app.py51 linesDownload Raw Back to root
1"""2GraphLLM - Modal Deployment3Serverless ML deployment with auto-scaling4"""5import modal6 7# Create Modal app8app = modal.App("graphllm")9 10# Define the container image with all dependencies11image = (12    modal.Image.debian_slim(python_version="3.12")13    .apt_install("tesseract-ocr", "ghostscript", "gcc", "g++")14    .pip_install_from_requirements("requirements.txt")15)16 17# Create persistent volume for data storage18volume = modal.Volume.from_name("graphllm-data", create_if_missing=True)19 20# Mount FastAPI app21@app.function(22    image=image,23    gpu=None,  # Use CPU (cheaper)24    memory=4096,  # 4GB RAM25    timeout=600,  # 10 min timeout26    volumes={"/app/data": volume},27    secrets=[modal.Secret.from_name("graphllm-secrets")],  # GEMINI_API_KEY28)29@modal.asgi_app()30def fastapi_app():31    """32    Mount the FastAPI application33    """34    import sys35    sys.path.insert(0, "/root")36 37    # Import main FastAPI app38    from main import app as fastapi_app39 40    return fastapi_app41 42 43# Local testing endpoint44@app.local_entrypoint()45def main():46    """47    Test the deployment locally48    """49    print("GraphLLM deployed to Modal!")50    print("Access your app at: https://YOUR_USERNAME--graphllm-fastapi-app.modal.run")51