Spaces:
Sleeping
Sleeping
| 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) | |