Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -1728,6 +1728,24 @@ def get_user_spaces():
|
|
1728 |
def create_main_interface():
|
1729 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
1730 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1731 |
with gr.Blocks(css="""
|
1732 |
/* ๋ฉ์ธ ํญ ์คํ์ผ */
|
1733 |
.main-tabs > div.tab-nav > button {
|
@@ -1963,8 +1981,4 @@ def create_main_interface():
|
|
1963 |
outputs=[deploy_result]
|
1964 |
)
|
1965 |
|
1966 |
-
return demo
|
1967 |
-
|
1968 |
-
if __name__ == "__main__":
|
1969 |
-
demo = create_main_interface()
|
1970 |
-
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|
|
|
1728 |
def create_main_interface():
|
1729 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
1730 |
|
1731 |
+
def execute_code(query: str):
|
1732 |
+
if not query or query.strip() == '':
|
1733 |
+
return None, gr.update(active_key="empty")
|
1734 |
+
|
1735 |
+
try:
|
1736 |
+
# HTML ์ฝ๋ ๋ธ๋ก ํ์ธ
|
1737 |
+
if '```html' in query and '```' in query:
|
1738 |
+
# HTML ์ฝ๋ ๋ธ๋ก ์ถ์ถ
|
1739 |
+
code = remove_code_block(query)
|
1740 |
+
else:
|
1741 |
+
# ์
๋ ฅ๋ ํ
์คํธ๋ฅผ ๊ทธ๋๋ก ์ฝ๋๋ก ์ฌ์ฉ
|
1742 |
+
code = query.strip()
|
1743 |
+
|
1744 |
+
return send_to_sandbox(code), gr.update(active_key="render")
|
1745 |
+
except Exception as e:
|
1746 |
+
print(f"Error executing code: {str(e)}")
|
1747 |
+
return None, gr.update(active_key="empty")
|
1748 |
+
|
1749 |
with gr.Blocks(css="""
|
1750 |
/* ๋ฉ์ธ ํญ ์คํ์ผ */
|
1751 |
.main-tabs > div.tab-nav > button {
|
|
|
1981 |
outputs=[deploy_result]
|
1982 |
)
|
1983 |
|
1984 |
+
return demo
|
|
|
|
|
|
|
|