import gradio as gr from gradio_client import Client API_URL = "rr19tech/PLNB-Model-SMOL" client = Client(API_URL) # 2. Our "Static" Context STATIC_CONTEXT = """ PLNB breakfast menu consists of idly, dosa PLNB lunch menu consistes of dal, rice, roti and curry PLNB dinner menu consists of roti and kheer """ def test_rag_client(question, history): # Construct the prompt with the static context prompt = f"""Use the provided context to answer the question. Context: {STATIC_CONTEXT} Question: {question} Answer:""" try: # Call the backend API # Ensure your backend uses gr.Interface(fn=chat_api, ...) for /predict result = client.predict(message=prompt, api_name="/chat") return result except Exception as e: return f"Backend Error: {str(e)}" # Simple UI to test the context demo = gr.ChatInterface( fn=test_rag_client, title="Static Context Test", description="Ask PLNB menu questions" ) demo.launch()