Spaces:
Running
Running
| import streamlit as st | |
| import os | |
| import base64 | |
| import types | |
| # Secretμμ μ μ₯λ μ½λ κ°μ Έμ€κΈ° | |
| app_code = os.environ.get("APP", "") | |
| # μ½λ μ€ν ν¨μ | |
| def execute_code(code_str): | |
| try: | |
| # μ€ν κ°λ₯ν μ½λλ‘ λ³ν | |
| code_module = types.ModuleType('dynamic_code') | |
| exec(code_str, code_module.__dict__) | |
| # νμν ν¨μ μ€ν | |
| if hasattr(code_module, 'main'): | |
| code_module.main() | |
| except Exception as e: | |
| st.error(f"μ½λ μ€ν μ€ μ€λ₯ λ°μ: {str(e)}") | |
| # μ½λ μ€ν | |
| if app_code: | |
| execute_code(app_code) | |
| else: | |
| st.error("μ½λλ₯Ό λΆλ¬μ¬ μ μμ΅λλ€. Secretμ΄ μ¬λ°λ₯΄κ² μ€μ λμλμ§ νμΈνμΈμ.") |