Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -911,18 +911,6 @@ def handle_boost(prompt: str):
|
|
911 |
demo_instance = Demo()
|
912 |
|
913 |
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
def take_screenshot(url):
|
927 |
"""์น์ฌ์ดํธ ์คํฌ๋ฆฐ์ท ์ดฌ์ ํจ์ (๋ก๋ฉ ๋๊ธฐ ์๊ฐ ์ถ๊ฐ)"""
|
928 |
if not url.startswith('http'):
|
@@ -1741,6 +1729,7 @@ def create_main_interface():
|
|
1741 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
1742 |
|
1743 |
with gr.Blocks(css="""
|
|
|
1744 |
.main-tabs > div.tab-nav > button {
|
1745 |
font-size: 1.1em !important;
|
1746 |
padding: 0.5em 1em !important;
|
@@ -1758,6 +1747,41 @@ def create_main_interface():
|
|
1758 |
border-radius: 0 0 15px 15px !important;
|
1759 |
box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
|
1760 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1761 |
""", theme=theme) as demo:
|
1762 |
with gr.Tabs(elem_classes="main-tabs") as tabs:
|
1763 |
# ๊ฐค๋ฌ๋ฆฌ ํญ
|
@@ -1808,7 +1832,12 @@ def create_main_interface():
|
|
1808 |
<div class="left_header">
|
1809 |
<img src="data:image/gif;base64,{get_image_base64('mouse.gif')}" width="360px" />
|
1810 |
<h1 style="font-size: 18px;">๊ณ ์์ด๋ ๋ฐ๋ก ์ฝ๋ฉํ๋ 'MOUSE-I'</h2>
|
1811 |
-
<h1 style="font-size: 10px;">ํ
ํ๋ฆฟ์ ํ๋กฌํํธ๋ฅผ ๋ณต์ฌํ์ฌ ๋ถ์ฌ๋ฃ๊ณ Send ํด๋ฆญ์ ์๋์ผ๋ก ์ฝ๋๊ฐ
|
|
|
|
|
|
|
|
|
|
|
1812 |
</div>
|
1813 |
""")
|
1814 |
|
@@ -1851,116 +1880,88 @@ def create_main_interface():
|
|
1851 |
with antd.Tabs.Item(key="render"):
|
1852 |
sandbox = gr.HTML(elem_classes="html_content")
|
1853 |
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
btn.click(
|
1937 |
-
demo_instance.generation_code,
|
1938 |
-
inputs=[input, setting, history],
|
1939 |
-
outputs=[code_output, history, sandbox, state_tab, code_drawer]
|
1940 |
-
)
|
1941 |
-
|
1942 |
-
clear_btn.click(
|
1943 |
-
demo_instance.clear_history,
|
1944 |
-
inputs=[],
|
1945 |
-
outputs=[history]
|
1946 |
-
)
|
1947 |
-
|
1948 |
-
# UI์ Boost ๋ฒํผ ์ด๋ฒคํธ ์ฐ๊ฒฐ ์์
|
1949 |
-
boost_btn.click(
|
1950 |
-
fn=handle_boost,
|
1951 |
-
inputs=[input],
|
1952 |
-
outputs=[input, state_tab]
|
1953 |
-
)
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
# ์ด๋ฒคํธ ํธ๋ค๋ฌ ์์
|
1958 |
-
deploy_btn.click(
|
1959 |
-
fn=lambda code: deploy_to_vercel(remove_code_block(code)) if code else "์ฝ๋๊ฐ ์์ต๋๋ค.",
|
1960 |
-
inputs=[code_output],
|
1961 |
-
outputs=[deploy_result]
|
1962 |
-
)
|
1963 |
-
|
1964 |
|
1965 |
return demo
|
1966 |
|
|
|
911 |
demo_instance = Demo()
|
912 |
|
913 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
914 |
def take_screenshot(url):
|
915 |
"""์น์ฌ์ดํธ ์คํฌ๋ฆฐ์ท ์ดฌ์ ํจ์ (๋ก๋ฉ ๋๊ธฐ ์๊ฐ ์ถ๊ฐ)"""
|
916 |
if not url.startswith('http'):
|
|
|
1729 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
1730 |
|
1731 |
with gr.Blocks(css="""
|
1732 |
+
/* ๋ฉ์ธ ํญ ์คํ์ผ */
|
1733 |
.main-tabs > div.tab-nav > button {
|
1734 |
font-size: 1.1em !important;
|
1735 |
padding: 0.5em 1em !important;
|
|
|
1747 |
border-radius: 0 0 15px 15px !important;
|
1748 |
box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
|
1749 |
}
|
1750 |
+
|
1751 |
+
/* MOUSE ์ธํฐํ์ด์ค ์คํ์ผ */
|
1752 |
+
.left_header {
|
1753 |
+
text-align: center;
|
1754 |
+
margin-bottom: 20px;
|
1755 |
+
}
|
1756 |
+
.right_panel {
|
1757 |
+
background: white;
|
1758 |
+
border-radius: 15px;
|
1759 |
+
padding: 20px;
|
1760 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
1761 |
+
}
|
1762 |
+
.setting-buttons {
|
1763 |
+
margin-bottom: 15px;
|
1764 |
+
}
|
1765 |
+
.render_header {
|
1766 |
+
background: #f5f5f5;
|
1767 |
+
padding: 10px;
|
1768 |
+
border-radius: 8px;
|
1769 |
+
margin-bottom: 15px;
|
1770 |
+
}
|
1771 |
+
.header_btn {
|
1772 |
+
display: inline-block;
|
1773 |
+
width: 12px;
|
1774 |
+
height: 12px;
|
1775 |
+
border-radius: 50%;
|
1776 |
+
margin-right: 8px;
|
1777 |
+
background: #ddd;
|
1778 |
+
}
|
1779 |
+
.html_content {
|
1780 |
+
min-height: 500px;
|
1781 |
+
border: 1px solid #eee;
|
1782 |
+
border-radius: 8px;
|
1783 |
+
overflow: hidden;
|
1784 |
+
}
|
1785 |
""", theme=theme) as demo:
|
1786 |
with gr.Tabs(elem_classes="main-tabs") as tabs:
|
1787 |
# ๊ฐค๋ฌ๋ฆฌ ํญ
|
|
|
1832 |
<div class="left_header">
|
1833 |
<img src="data:image/gif;base64,{get_image_base64('mouse.gif')}" width="360px" />
|
1834 |
<h1 style="font-size: 18px;">๊ณ ์์ด๋ ๋ฐ๋ก ์ฝ๋ฉํ๋ 'MOUSE-I'</h2>
|
1835 |
+
<h1 style="font-size: 10px;">ํ
ํ๋ฆฟ์ ํ๋กฌํํธ๋ฅผ ๋ณต์ฌํ์ฌ ๋ถ์ฌ๋ฃ๊ณ Send ํด๋ฆญ์ ์๋์ผ๋ก ์ฝ๋๊ฐ ์์ฑ๋ฉ๋๋ค. ์์ฑ ๊ฒฐ๊ณผ๋ฅผ ํ์ธ ๋ฐฐํฌํ๊ธฐ ํด๋ฆญ์ ๊ธ๋ก๋ฒ ํฌ๋ผ์ฐ๋ Vercel์ ํตํด ์น์๋น์ค๊ฐ ๋ฐฐํฌ๋ฉ๋๋ค. ์์ฑ๋ ์ฝ๋๋ง ํ๋กฌํํธ์ ๋ถ์ฌ๋ฃ๊ณ 'Code ์คํ' ๋ฒํผ ํด๋ฆญ์ ํ๋ฉด์ ์ฆ์ ์๋น์ค๊ฐ ์คํ. ๋ฌธ์: arxivgpt@gmail.com</h1>
|
1836 |
+
<h1 style="font-size: 12px; margin-top: 10px;">
|
1837 |
+
<a href="https://openfree-gallery.hf.space" target="_blank" style="color: #0084ff; text-decoration: none; transition: color 0.3s;">
|
1838 |
+
๐จ MOUSE๋ก ์์ฑํ ์น์ฑ ๊ณต๊ฐ ๊ฐค๋ฌ๋ฆฌ ๋ฐ๋ก๊ฐ๊ธฐ ํด๋ฆญ
|
1839 |
+
</a>
|
1840 |
+
</h1>
|
1841 |
</div>
|
1842 |
""")
|
1843 |
|
|
|
1880 |
with antd.Tabs.Item(key="render"):
|
1881 |
sandbox = gr.HTML(elem_classes="html_content")
|
1882 |
|
1883 |
+
# ์ด๋ฒคํธ ํธ๋ค๋ฌ ์ฐ๊ฒฐ
|
1884 |
+
execute_btn.click(
|
1885 |
+
fn=execute_code,
|
1886 |
+
inputs=[input],
|
1887 |
+
outputs=[sandbox, state_tab]
|
1888 |
+
)
|
1889 |
+
|
1890 |
+
codeBtn.click(
|
1891 |
+
lambda: gr.update(open=True),
|
1892 |
+
inputs=[],
|
1893 |
+
outputs=[code_drawer]
|
1894 |
+
)
|
1895 |
+
|
1896 |
+
code_drawer.close(
|
1897 |
+
lambda: gr.update(open=False),
|
1898 |
+
inputs=[],
|
1899 |
+
outputs=[code_drawer]
|
1900 |
+
)
|
1901 |
+
|
1902 |
+
historyBtn.click(
|
1903 |
+
history_render,
|
1904 |
+
inputs=[history],
|
1905 |
+
outputs=[history_drawer, history_output]
|
1906 |
+
)
|
1907 |
+
|
1908 |
+
history_drawer.close(
|
1909 |
+
lambda: gr.update(open=False),
|
1910 |
+
inputs=[],
|
1911 |
+
outputs=[history_drawer]
|
1912 |
+
)
|
1913 |
+
|
1914 |
+
best_btn.click(
|
1915 |
+
fn=lambda: (gr.update(open=True), load_best_templates()),
|
1916 |
+
outputs=[session_drawer, session_history],
|
1917 |
+
queue=False
|
1918 |
+
)
|
1919 |
+
|
1920 |
+
trending_btn.click(
|
1921 |
+
fn=lambda: (gr.update(open=True), load_trending_templates()),
|
1922 |
+
outputs=[session_drawer, session_history],
|
1923 |
+
queue=False
|
1924 |
+
)
|
1925 |
+
|
1926 |
+
new_btn.click(
|
1927 |
+
fn=lambda: (gr.update(open=True), load_new_templates()),
|
1928 |
+
outputs=[session_drawer, session_history],
|
1929 |
+
queue=False
|
1930 |
+
)
|
1931 |
+
|
1932 |
+
session_drawer.close(
|
1933 |
+
lambda: (gr.update(open=False), gr.HTML("")),
|
1934 |
+
outputs=[session_drawer, session_history]
|
1935 |
+
)
|
1936 |
+
|
1937 |
+
close_btn.click(
|
1938 |
+
lambda: (gr.update(open=False), gr.HTML("")),
|
1939 |
+
outputs=[session_drawer, session_history]
|
1940 |
+
)
|
1941 |
+
|
1942 |
+
btn.click(
|
1943 |
+
demo_instance.generation_code,
|
1944 |
+
inputs=[input, setting, history],
|
1945 |
+
outputs=[code_output, history, sandbox, state_tab, code_drawer]
|
1946 |
+
)
|
1947 |
+
|
1948 |
+
clear_btn.click(
|
1949 |
+
demo_instance.clear_history,
|
1950 |
+
inputs=[],
|
1951 |
+
outputs=[history]
|
1952 |
+
)
|
1953 |
+
|
1954 |
+
boost_btn.click(
|
1955 |
+
fn=handle_boost,
|
1956 |
+
inputs=[input],
|
1957 |
+
outputs=[input, state_tab]
|
1958 |
+
)
|
1959 |
+
|
1960 |
+
deploy_btn.click(
|
1961 |
+
fn=lambda code: deploy_to_vercel(remove_code_block(code)) if code else "์ฝ๋๊ฐ ์์ต๋๋ค.",
|
1962 |
+
inputs=[code_output],
|
1963 |
+
outputs=[deploy_result]
|
1964 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1965 |
|
1966 |
return demo
|
1967 |
|