PranavRatnalikar's picture
Update app.py
f70a3bd verified
raw
history blame contribute delete
984 Bytes
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)