Spaces:
Running on Zero
Running on Zero
Download src/app.py from ibm-granite/LLMON-Attention-Visualization: direct link, hf CLI and curl.
- Browser
- Download file 919 Bytes
-
https://huggingface.co/spaces/ibm-granite/LLMON-Attention-Visualization/resolve/main/src/app.py
- Command line
-
hf download hf://spaces/ibm-granite/LLMON-Attention-Visualization/src/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ibm-granite/LLMON-Attention-Visualization/resolve/main/src/app.py
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"), | |
| ], | |
| ) | |