| """Serving backends for the FormScout judge/classifier VLM.""" | |
| from __future__ import annotations | |
| def get_vlm_client(): | |
| """Return the VLM client for the resolved judge backend. | |
| transformers (in-process, ZeroGPU) on a Space; llama-server locally. Falls | |
| back to the llama.cpp client if the transformers backend can't be imported. | |
| """ | |
| from formscout import config | |
| if config.resolve_judge_backend() == "transformers": | |
| try: | |
| from formscout.serving.transformers_vlm import TransformersVLMClient | |
| return TransformersVLMClient() | |
| except Exception: | |
| pass | |
| from formscout.serving.llama_cpp import LlamaCppClient | |
| return LlamaCppClient(port=config.LLAMA_CPP_PORT_VLM) | |