Spaces:
Sleeping
Sleeping
File size: 984 Bytes
f70a3bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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)
|