import gradio as gr from rag import rbc_product from tool import rival_product with gr.Blocks() as demo: with gr.Tab("RAG"): gr.Markdown(""" Marketing ------------ GraphRAG: Models customer-product relationship networks for next-best-action predictions DSPy: Optimizes cross-sell/upsell prompt variations through A/B testing Risk & Audit ------------ GraphRAG: Maps transactional relationships into dynamic knowledge graphs to detect multi-layered fraud patterns Tool Use: Integrates fraud detection APIs, anomaly scoring models, and regulatory compliance checkers DSPy: Optimizes fraud explanation prompts for regulatory reporting """) gr.Markdown(""" Retrieval: Public RBC Product Data Recommend: RBC Product """) in_verbatim = gr.Textbox(label="Verbatim") out_product = gr.Textbox(label="Product") gr.Examples( [ ["Low APR and great customer service. I would highly recommend if you’re looking for a great credit card company and looking to rebuild your credit. I have had my credit limit increased annually and the annual fee is very low."] ], [in_verbatim] ) btn_recommend=gr.Button("Recommend") btn_recommend.click(fn=rbc_product, inputs=in_verbatim, outputs=out_product) with gr.Tab("Tool Use"): gr.Markdown(""" Retrieval: Public Product Data using Tavily Search Recommend: Competition Product """) in_verbatim = gr.Textbox(label="Verbatim") out_product = gr.Textbox(label="Product") gr.Examples( [ ["Low APR and great customer service. I would highly recommend if you’re looking for a great credit card company and looking to rebuild your credit. I have had my credit limit increased annually and the annual fee is very low."] ], [in_verbatim] ) btn_recommend=gr.Button("Recommend") btn_recommend.click(fn=rival_product, inputs=in_verbatim, outputs=out_product) demo.launch(allowed_paths=["./xgb","./ts"])