Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -451,6 +451,12 @@ def deploy_to_vercel(code: str):
|
|
| 451 |
|
| 452 |
theme = gr.themes.Soft()
|
| 453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
def create_main_interface():
|
| 455 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
| 456 |
|
|
@@ -514,7 +520,8 @@ def create_main_interface():
|
|
| 514 |
input = antd.InputTextarea(
|
| 515 |
size="large",
|
| 516 |
allow_clear=True,
|
| 517 |
-
|
|
|
|
| 518 |
)
|
| 519 |
|
| 520 |
# ๋ฒํผ ๊ทธ๋ฃน
|
|
@@ -564,19 +571,29 @@ def create_main_interface():
|
|
| 564 |
inputs=[],
|
| 565 |
outputs=[history_drawer]
|
| 566 |
)
|
|
|
|
| 567 |
btn.click(
|
| 568 |
demo_instance.generation_code,
|
| 569 |
inputs=[input, setting, history],
|
| 570 |
outputs=[code_output, history, sandbox, state_tab, code_drawer]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
)
|
|
|
|
| 572 |
|
| 573 |
|
| 574 |
clear_btn.click(
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
|
|
|
|
|
|
|
|
|
| 578 |
)
|
| 579 |
|
|
|
|
| 580 |
boost_btn.click(
|
| 581 |
fn=handle_boost,
|
| 582 |
inputs=[input],
|
|
|
|
| 451 |
|
| 452 |
theme = gr.themes.Soft()
|
| 453 |
|
| 454 |
+
def get_random_placeholder():
|
| 455 |
+
return random.choice(DEMO_LIST)['description']
|
| 456 |
+
|
| 457 |
+
def update_placeholder():
|
| 458 |
+
return gr.update(placeholder=get_random_placeholder())
|
| 459 |
+
|
| 460 |
def create_main_interface():
|
| 461 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
| 462 |
|
|
|
|
| 520 |
input = antd.InputTextarea(
|
| 521 |
size="large",
|
| 522 |
allow_clear=True,
|
| 523 |
+
|
| 524 |
+
placeholder=get_random_placeholder()
|
| 525 |
)
|
| 526 |
|
| 527 |
# ๋ฒํผ ๊ทธ๋ฃน
|
|
|
|
| 571 |
inputs=[],
|
| 572 |
outputs=[history_drawer]
|
| 573 |
)
|
| 574 |
+
|
| 575 |
btn.click(
|
| 576 |
demo_instance.generation_code,
|
| 577 |
inputs=[input, setting, history],
|
| 578 |
outputs=[code_output, history, sandbox, state_tab, code_drawer]
|
| 579 |
+
).then( # then์ ์ฌ์ฉํ์ฌ ์ฐ์ ๋์ ์ถ๊ฐ
|
| 580 |
+
fn=update_placeholder,
|
| 581 |
+
inputs=[],
|
| 582 |
+
outputs=[input]
|
| 583 |
)
|
| 584 |
+
|
| 585 |
|
| 586 |
|
| 587 |
clear_btn.click(
|
| 588 |
+
fn=lambda: (
|
| 589 |
+
demo_instance.clear_history(), # history ์ด๊ธฐํ
|
| 590 |
+
update_placeholder() # placeholder ์
๋ฐ์ดํธ
|
| 591 |
+
),
|
| 592 |
+
inputs=[],
|
| 593 |
+
outputs=[history, input] # input๋ ์ถ๋ ฅ์ ์ถ๊ฐ
|
| 594 |
)
|
| 595 |
|
| 596 |
+
|
| 597 |
boost_btn.click(
|
| 598 |
fn=handle_boost,
|
| 599 |
inputs=[input],
|