File size: 2,453 Bytes
8202285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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}")