File size: 1,225 Bytes
29efb71
 
5709011
 
 
5488167
29efb71
5709011
 
 
 
 
29efb71
5709011
29efb71
 
5709011
 
 
 
 
 
 
 
 
071dfa9
5709011
 
 
 
 
 
 
29efb71
5709011
29efb71
 
5709011
 
 
5488167
 
29efb71
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
import streamlit as st
import os
import sys
from tempfile import NamedTemporaryFile
import traceback

def main():
    st.set_page_config(
        page_title="ACE Singer",
        page_icon="🎵",
        layout="wide"
    )
    
    st.title("🎵 ACE Singer")
    
    try:
        # Get the code from environment variables
        code = os.environ.get("MAIN_CODE")
        
        if not code:
            st.error("⚠️ The application code wasn't found in environment variables. Please add the MAIN_CODE.")
            st.info("Please set the MAIN_CODE environment variable with your application code.")
            return
        
        st.success("✅ Application code loaded successfully!")
        
        # Execute the code in a controlled way
        exec_globals = {
            '__name__': '__main__',
            'st': st,
            'os': os,
            'sys': sys
        }
        
        exec(compile(code, '<streamlit_app>', 'exec'), exec_globals)
        
    except Exception as e:
        st.error(f"⚠️ Error loading or executing the application: {str(e)}")
        with st.expander("Show detailed error"):
            st.code(traceback.format_exc())

if __name__ == "__main__":
    main()