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)