""" Vitalis MCP Server — Optional Web UI (Gradio). Run: python -m ui.web """ try: import gradio as gr HAS_GRADIO = True except ImportError: HAS_GRADIO = False from pipeline.manager import PipelineManager from training.generator import generate as gen_training manager = PipelineManager() def build_app(): if not HAS_GRADIO: print("Gradio not installed. Run: pip install gradio") return None def chat_fn(message, history): result = manager.process(message) meta = ( f"\n\nconfidence={result.get('confidence', 'N/A')}, " f"truthful={result.get('truthful', 'N/A')}, " f"sandbox={result.get('sandbox_passed', 'N/A')}" ) return result["response"] + meta demo = gr.ChatInterface( fn=chat_fn, title="Vitalis Cognitive Server", description="Bolts vitalis_core cognitive pipeline onto any model", theme="soft", ) return demo def main(): demo = build_app() if demo: demo.launch(server_port=7374) if __name__ == "__main__": main()