File size: 919 Bytes
5c49122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""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"),
        ],
    )