Bankquant-multiagents / streamlit_app.py
Sujatha's picture
Create streamlit_app.py
8202285 verified
Raw History Blame Contribute Delete
2.45 kB
import streamlit as st
import sys
import os
import subprocess
import time
# Force immediate display
st.set_page_config(
page_title="BankQuant AI Agents",
page_icon="🏦",
layout="wide",
initial_sidebar_state="expanded"
)
st.title("🏦 BankQuant Multi-Agent System")
st.markdown("### Quantitative Finance AI Assistant Platform")
# Show that we're in the right file
st.success("βœ… Running from streamlit_app.py")
# Check what files exist
st.markdown("### Files in current directory:")
try:
files = os.listdir('.')
for f in sorted(files):
if f.endswith('.py'):
st.code(f"πŸ“ {f}")
else:
st.text(f"πŸ“„ {f}")
except Exception as e:
st.error(f"Error listing files: {e}")
# Try to import and run your app.py
if os.path.exists("app.py"):
st.success("βœ… Found app.py!")
# Clear module cache to force reload
if 'app' in sys.modules:
del sys.modules['app']
try:
# Add current directory to path
sys.path.insert(0, '.')
# Import your app
import app
st.info("πŸš€ Loading your QuantProdigy app...")
# Check if app has a main function
if hasattr(app, 'main'):
# Run the main function
app.main()
else:
st.warning("app.py doesn't have a main() function")
st.markdown("### Contents of app.py:")
with open("app.py", "r") as f:
st.code(f.read()[:1000] + "..." if len(f.read()) > 1000 else f.read())
except Exception as e:
st.error(f"❌ Error importing app.py: {str(e)}")
import traceback
with st.expander("πŸ” Full Error Traceback"):
st.code(traceback.format_exc())
else:
st.error("❌ app.py not found in root directory!")
# Option to create a simple app.py
if st.button("Create simple app.py for testing"):
simple_app = '''
import streamlit as st
st.title("Test BankQuant App")
st.success("This is a test app")
st.write("Your main app will load here once you upload it.")
'''
with open("app.py", "w") as f:
f.write(simple_app)
st.success("Created app.py! Refresh to see it.")
st.rerun()
# Add a test section
st.markdown("---")
st.markdown("### Test Input")
test_input = st.text_input("Enter something to test:")
if test_input:
st.write(f"You entered: {test_input}")