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이 μ˜¬λ°”λ₯΄κ²Œ μ„€μ •λ˜μ—ˆλŠ”μ§€ ν™•μΈν•˜μ„Έμš”.")