abedaniels's picture
Recreate LLMON attention demo from ibm-granite/llmon-attention-viz@b4cb88a
5c49122 verified
Raw History Blame Contribute Delete
919 Bytes
"""Hugging Face Gradio entry point; model loading happens before serving requests."""
import logging
import os
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from app import ROOT, app, engine
if __name__ == "__main__":
try:
engine.prepare()
except Exception:
logging.exception("Could not initialize the configured LLMON checkpoint.")
engine.status = "load_failed"
engine.message = "The configured model could not be loaded. Please contact the demo owner."
app.launch(
server_name="0.0.0.0",
server_port=int(os.getenv("PORT", "7860")),
share=False,
show_error=False,
max_file_size="1mb",
blocked_paths=[
str(ROOT / "models"),
str(ROOT / "vendor"),
str(ROOT / ".env"),
str(ROOT / "new_dlb_examples.jsonl"),
],
)