Update mouse.py
Browse files
mouse.py
CHANGED
|
@@ -904,15 +904,18 @@ def handle_boost(prompt: str):
|
|
| 904 |
|
| 905 |
# ํ์ผ ์๋จ์์ ์ ์ญ ๋ณ์ ์ ์ธ
|
| 906 |
mouse_interface = None
|
|
|
|
|
|
|
| 907 |
|
| 908 |
with gr.Blocks(css_paths="app.css",theme=theme) as demo:
|
| 909 |
-
# global ํค์๋ ์ ๊ฑฐ (์ด๋ฏธ ์๋จ์์ ์ ์ธํ์ผ๋ฏ๋ก)
|
| 910 |
mouse_interface = demo
|
| 911 |
-
|
| 912 |
history = gr.State([])
|
| 913 |
setting = gr.State({
|
| 914 |
"system": SystemPrompt,
|
| 915 |
})
|
|
|
|
|
|
|
| 916 |
|
| 917 |
|
| 918 |
with ms.Application() as app:
|
|
@@ -1078,13 +1081,16 @@ with gr.Blocks(css_paths="app.css",theme=theme) as demo:
|
|
| 1078 |
lambda: (gr.update(open=False), gr.HTML("")),
|
| 1079 |
outputs=[session_drawer, session_history]
|
| 1080 |
)
|
| 1081 |
-
|
|
|
|
| 1082 |
btn.click(
|
| 1083 |
-
demo_instance.generation_code,
|
| 1084 |
inputs=[input, setting, history],
|
| 1085 |
outputs=[code_output, history, sandbox, state_tab, code_drawer]
|
| 1086 |
)
|
| 1087 |
|
|
|
|
|
|
|
| 1088 |
clear_btn.click(
|
| 1089 |
demo_instance.clear_history,
|
| 1090 |
inputs=[],
|
|
@@ -1108,12 +1114,10 @@ with gr.Blocks(css_paths="app.css",theme=theme) as demo:
|
|
| 1108 |
)
|
| 1109 |
|
| 1110 |
|
| 1111 |
-
#
|
| 1112 |
if __name__ == "__main__":
|
| 1113 |
try:
|
| 1114 |
-
|
| 1115 |
-
demo.queue(default_concurrency_limit=20) # .launch() ๋ถ๋ถ๋ง ์ ๊ฑฐ
|
| 1116 |
except Exception as e:
|
| 1117 |
print(f"Initialization error: {e}")
|
| 1118 |
-
raise
|
| 1119 |
-
|
|
|
|
| 904 |
|
| 905 |
# ํ์ผ ์๋จ์์ ์ ์ญ ๋ณ์ ์ ์ธ
|
| 906 |
mouse_interface = None
|
| 907 |
+
demo = None
|
| 908 |
+
demo_instance = Demo() # Demo ์ธ์คํด์ค๋ฅผ ๋จผ์ ์์ฑ
|
| 909 |
|
| 910 |
with gr.Blocks(css_paths="app.css",theme=theme) as demo:
|
|
|
|
| 911 |
mouse_interface = demo
|
| 912 |
+
|
| 913 |
history = gr.State([])
|
| 914 |
setting = gr.State({
|
| 915 |
"system": SystemPrompt,
|
| 916 |
})
|
| 917 |
+
|
| 918 |
+
|
| 919 |
|
| 920 |
|
| 921 |
with ms.Application() as app:
|
|
|
|
| 1081 |
lambda: (gr.update(open=False), gr.HTML("")),
|
| 1082 |
outputs=[session_drawer, session_history]
|
| 1083 |
)
|
| 1084 |
+
|
| 1085 |
+
# ์ด๋ฒคํธ ํธ๋ค๋ฌ๋ค
|
| 1086 |
btn.click(
|
| 1087 |
+
demo_instance.generation_code, # ์ด์ demo_instance๋ฅผ ์ฌ์ฉํ ์ ์์
|
| 1088 |
inputs=[input, setting, history],
|
| 1089 |
outputs=[code_output, history, sandbox, state_tab, code_drawer]
|
| 1090 |
)
|
| 1091 |
|
| 1092 |
+
|
| 1093 |
+
|
| 1094 |
clear_btn.click(
|
| 1095 |
demo_instance.clear_history,
|
| 1096 |
inputs=[],
|
|
|
|
| 1114 |
)
|
| 1115 |
|
| 1116 |
|
| 1117 |
+
# ํ์ผ ๋งจ ์๋์ ์คํ ๋ถ๋ถ
|
| 1118 |
if __name__ == "__main__":
|
| 1119 |
try:
|
| 1120 |
+
demo.queue(default_concurrency_limit=20)
|
|
|
|
| 1121 |
except Exception as e:
|
| 1122 |
print(f"Initialization error: {e}")
|
| 1123 |
+
raise
|
|
|