import streamlit as st import os import subprocess from chatbot import query_chatbot st.set_page_config(page_title="💰 Financial Chatbot", layout="wide") st.title("💰 Financial AI Assistant") st.markdown("Ask anything about **finance, RBI regulations, fraud detection, stock trends, and banking**.") api_key = st.sidebar.text_input("🔑 Enter your Google API Key:", type="password") # Sidebar Precompute Button st.sidebar.header("📌 Precompute Financial Data") if st.sidebar.button("🚀 Run Precompute"): with st.spinner("🔄 Processing financial documents..."): os.system(f"GOOGLE_API_KEY={api_key} python data_loader.py") # Run preprocessing st.sidebar.success("✅ Precompute completed!") # Chatbot Input question = st.text_input("🔍 Ask a financial question:") if question and api_key: with st.spinner("🔄 Processing..."): response = query_chatbot(question, api_key) st.success("✅ Answer:") st.write(response)