| 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() | |