File size: 633 Bytes
12a88e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from llm import financial_chat, get_groq_client  # Make sure llm.py is importable

# Load the Groq client once to reuse
groq_client = get_groq_client()

def chat_with_user(user_input):
    return financial_chat(user_input, groq_client=groq_client)

# Create the Gradio Interface
iface = gr.Interface(
    fn=chat_with_user,
    inputs=gr.Textbox(label="Ask your finance-related question here:"),
    outputs=gr.Textbox(label="FinanceWise AI Response"),
    title="FinanceWise AI Assistant",
    description="This assistant only answers finance-related questions."
)

if __name__ == "__main__":
    iface.launch()