Spaces:
Running
Running
File size: 1,010 Bytes
1e18f11 d48cdf4 b87d0ef d48cdf4 b87d0ef b7a60fa b87d0ef 55d6d84 b87d0ef b7a60fa b87d0ef b7a60fa b87d0ef b7a60fa b87d0ef b7a60fa b87d0ef b7a60fa 52f7adf b87d0ef b7a60fa b87d0ef d48cdf4 5a98a93 b87d0ef |
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 |
#코드: openfree/Chart-GPT-BACKUP
import os
import sys
import streamlit as st
from tempfile import NamedTemporaryFile
def main():
try:
# Get the code from secrets
code = os.environ.get("MAIN_CODE")
if not code:
st.error("⚠️ The application code wasn't found in secrets. Please add the MAIN_CODE secret.")
return
# Create a temporary Python file
with NamedTemporaryFile(suffix='.py', delete=False, mode='w') as tmp:
tmp.write(code)
tmp_path = tmp.name
# Execute the code
exec(compile(code, tmp_path, 'exec'), globals())
# Clean up the temporary file
try:
os.unlink(tmp_path)
except:
pass
except Exception as e:
st.error(f"⚠️ Error loading or executing the application: {str(e)}")
import traceback
st.code(traceback.format_exc())
if __name__ == "__main__":
main() |