Spaces:
Running
Running
File size: 728 Bytes
8b8afd7 f025afc 8b8afd7 f025afc 8b8afd7 f025afc 8b8afd7 f025afc 8b8afd7 f025afc 8b8afd7 f025afc 8b8afd7 f025afc |
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 |
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μ΄ μ¬λ°λ₯΄κ² μ€μ λμλμ§ νμΈνμΈμ.") |