Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -566,173 +566,7 @@ def get_random_placeholder():
|
|
| 566 |
def update_placeholder():
|
| 567 |
return gr.update(placeholder=get_random_placeholder())
|
| 568 |
|
| 569 |
-
custom_css = """
|
| 570 |
-
/* ์ ์ฒด ์ปจํ
์ด๋ ์คํ์ผ๋ง */
|
| 571 |
-
.main-tabs {
|
| 572 |
-
background: #ffffff;
|
| 573 |
-
border-radius: 15px;
|
| 574 |
-
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
| 575 |
-
padding: 20px;
|
| 576 |
-
margin: 20px;
|
| 577 |
-
}
|
| 578 |
-
|
| 579 |
-
/* ์ข์ธก ํจ๋ ์คํ์ผ๋ง */
|
| 580 |
-
.left-panel {
|
| 581 |
-
background: #f8f9fa;
|
| 582 |
-
border-radius: 12px;
|
| 583 |
-
padding: 20px;
|
| 584 |
-
margin: 10px;
|
| 585 |
-
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
| 586 |
-
}
|
| 587 |
-
|
| 588 |
-
/* ์ฐ์ธก ํจ๋ ์คํ์ผ๋ง */
|
| 589 |
-
.right-panel {
|
| 590 |
-
background: #ffffff;
|
| 591 |
-
border-radius: 12px;
|
| 592 |
-
padding: 20px;
|
| 593 |
-
margin: 10px;
|
| 594 |
-
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
| 595 |
-
}
|
| 596 |
-
|
| 597 |
-
/* ์
๋ ฅ ์์ญ ์คํ์ผ๋ง */
|
| 598 |
-
.custom-textarea {
|
| 599 |
-
background: #ffffff !important;
|
| 600 |
-
border: 1px solid #e0e0e0 !important;
|
| 601 |
-
border-radius: 10px !important;
|
| 602 |
-
padding: 15px !important;
|
| 603 |
-
min-height: 150px !important;
|
| 604 |
-
font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 605 |
-
margin-bottom: 20px !important;
|
| 606 |
-
}
|
| 607 |
-
|
| 608 |
-
.custom-textarea:focus {
|
| 609 |
-
border-color: #007aff !important;
|
| 610 |
-
box-shadow: 0 0 0 2px rgba(0,122,255,0.2) !important;
|
| 611 |
-
}
|
| 612 |
-
|
| 613 |
-
/* ๋ฒํผ ์คํ์ผ๋ง */
|
| 614 |
-
.generate-btn {
|
| 615 |
-
background: #007aff !important;
|
| 616 |
-
color: white !important;
|
| 617 |
-
border-radius: 8px !important;
|
| 618 |
-
padding: 10px 20px !important;
|
| 619 |
-
font-weight: 500 !important;
|
| 620 |
-
transition: all 0.3s ease !important;
|
| 621 |
-
border: none !important;
|
| 622 |
-
box-shadow: 0 2px 4px rgba(0,122,255,0.2) !important;
|
| 623 |
-
}
|
| 624 |
|
| 625 |
-
.enhance-btn, .share-btn {
|
| 626 |
-
background: white !important;
|
| 627 |
-
border-radius: 8px !important;
|
| 628 |
-
padding: 10px 20px !important;
|
| 629 |
-
font-weight: 500 !important;
|
| 630 |
-
transition: all 0.3s ease !important;
|
| 631 |
-
}
|
| 632 |
-
|
| 633 |
-
.enhance-btn {
|
| 634 |
-
color: #007aff !important;
|
| 635 |
-
border: 1px solid #007aff !important;
|
| 636 |
-
}
|
| 637 |
-
|
| 638 |
-
.share-btn {
|
| 639 |
-
color: #28c840 !important;
|
| 640 |
-
border: 1px solid #28c840 !important;
|
| 641 |
-
}
|
| 642 |
-
|
| 643 |
-
/* ๋ฒํผ ํธ๋ฒ ํจ๊ณผ */
|
| 644 |
-
.generate-btn:hover {
|
| 645 |
-
background: #0056b3 !important;
|
| 646 |
-
transform: translateY(-1px);
|
| 647 |
-
}
|
| 648 |
-
|
| 649 |
-
.enhance-btn:hover {
|
| 650 |
-
background: rgba(0,122,255,0.1) !important;
|
| 651 |
-
transform: translateY(-1px);
|
| 652 |
-
}
|
| 653 |
-
|
| 654 |
-
.share-btn:hover {
|
| 655 |
-
background: rgba(40,200,64,0.1) !important;
|
| 656 |
-
transform: translateY(-1px);
|
| 657 |
-
}
|
| 658 |
-
|
| 659 |
-
/* ๋ชจ๋ ์ ํ๊ธฐ ์คํ์ผ๋ง */
|
| 660 |
-
.mode-selector {
|
| 661 |
-
background: white !important;
|
| 662 |
-
padding: 15px !important;
|
| 663 |
-
border-radius: 10px !important;
|
| 664 |
-
margin-bottom: 20px !important;
|
| 665 |
-
box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
|
| 666 |
-
}
|
| 667 |
-
|
| 668 |
-
/* ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ฐฝ ์คํ์ผ๋ง */
|
| 669 |
-
.window-frame {
|
| 670 |
-
background: white;
|
| 671 |
-
border-radius: 10px;
|
| 672 |
-
overflow: hidden;
|
| 673 |
-
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
| 674 |
-
}
|
| 675 |
-
|
| 676 |
-
.window-header {
|
| 677 |
-
background: #f8f9fa;
|
| 678 |
-
padding: 10px 15px;
|
| 679 |
-
border-bottom: 1px solid #e0e0e0;
|
| 680 |
-
display: flex;
|
| 681 |
-
align-items: center;
|
| 682 |
-
}
|
| 683 |
-
|
| 684 |
-
.window-controls {
|
| 685 |
-
display: flex;
|
| 686 |
-
gap: 8px;
|
| 687 |
-
}
|
| 688 |
-
|
| 689 |
-
.control {
|
| 690 |
-
width: 12px;
|
| 691 |
-
height: 12px;
|
| 692 |
-
border-radius: 50%;
|
| 693 |
-
}
|
| 694 |
-
|
| 695 |
-
.close { background: #ff5f57; }
|
| 696 |
-
.minimize { background: #febc2e; }
|
| 697 |
-
.maximize { background: #28c840; }
|
| 698 |
-
|
| 699 |
-
/* ๊ฒฐ๊ณผ ์์ญ ์คํ์ผ๋ง */
|
| 700 |
-
.html_content {
|
| 701 |
-
background: white;
|
| 702 |
-
border-radius: 10px;
|
| 703 |
-
padding: 20px;
|
| 704 |
-
margin-top: 15px;
|
| 705 |
-
min-height: 400px;
|
| 706 |
-
}
|
| 707 |
-
|
| 708 |
-
/* ๋ก๋ฉ ์ํ ์คํ์ผ๋ง */
|
| 709 |
-
.right_content {
|
| 710 |
-
padding: 40px;
|
| 711 |
-
text-align: center;
|
| 712 |
-
}
|
| 713 |
-
|
| 714 |
-
/* ์๋ฌ ์ํ ์คํ์ผ๋ง */
|
| 715 |
-
.error-content {
|
| 716 |
-
background: #fff2f0;
|
| 717 |
-
border: 1px solid #ff4d4f;
|
| 718 |
-
padding: 20px;
|
| 719 |
-
border-radius: 8px;
|
| 720 |
-
margin-top: 15px;
|
| 721 |
-
}
|
| 722 |
-
|
| 723 |
-
/* ๋ฐ์ํ ๋์์ธ */
|
| 724 |
-
@media (max-width: 768px) {
|
| 725 |
-
.main-tabs {
|
| 726 |
-
margin: 10px;
|
| 727 |
-
padding: 10px;
|
| 728 |
-
}
|
| 729 |
-
|
| 730 |
-
.left-panel, .right-panel {
|
| 731 |
-
margin: 5px;
|
| 732 |
-
padding: 10px;
|
| 733 |
-
}
|
| 734 |
-
}
|
| 735 |
-
"""
|
| 736 |
|
| 737 |
def create_main_interface():
|
| 738 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
|
@@ -853,160 +687,289 @@ The response should be in HTML format with appropriate styling."""
|
|
| 853 |
with open('app.css', 'r', encoding='utf-8') as f:
|
| 854 |
custom_css = f.read()
|
| 855 |
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
}
|
| 864 |
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
|
|
|
|
|
|
|
|
|
| 872 |
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 877 |
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 882 |
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
|
|
|
| 889 |
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
.container {
|
| 898 |
-
background: #f0f0f0;
|
| 899 |
-
min-height: 100vh;
|
| 900 |
-
padding: 20px;
|
| 901 |
-
display: flex;
|
| 902 |
-
justify-content: center;
|
| 903 |
-
align-items: center;
|
| 904 |
-
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
|
| 905 |
-
}
|
| 906 |
|
| 907 |
-
|
| 908 |
-
|
| 909 |
-
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 913 |
|
| 914 |
-
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 920 |
|
| 921 |
-
|
| 922 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 923 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 924 |
"""
|
| 925 |
-
demo = gr.Blocks(css=custom_css, theme=theme)
|
| 926 |
|
|
|
|
| 927 |
|
| 928 |
with demo:
|
| 929 |
-
with gr.Row():
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
|
| 935 |
-
|
| 936 |
-
|
| 937 |
-
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
|
| 951 |
-
|
| 952 |
-
|
| 953 |
-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 960 |
<div class="window-controls">
|
| 961 |
<div class="control close"></div>
|
| 962 |
<div class="control minimize"></div>
|
| 963 |
<div class="control maximize"></div>
|
| 964 |
</div>
|
| 965 |
-
<div
|
| 966 |
</div>
|
| 967 |
-
|
| 968 |
-
|
| 969 |
-
|
| 970 |
-
|
| 971 |
-
|
| 972 |
-
|
| 973 |
-
|
| 974 |
-
|
| 975 |
-
gr.
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
gr.Markdown("An error occurred. Please try again.")
|
| 980 |
|
| 981 |
# ์ํ ๋ณ์๋ค
|
| 982 |
setting = gr.State({"system": SystemPrompt})
|
| 983 |
search_mode = gr.State(False)
|
| 984 |
code_output = gr.State("")
|
| 985 |
|
| 986 |
-
#
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
boost_btn.click(
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
|
| 1009 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1010 |
|
| 1011 |
return demo
|
| 1012 |
|
|
|
|
| 566 |
def update_placeholder():
|
| 567 |
return gr.update(placeholder=get_random_placeholder())
|
| 568 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 570 |
|
| 571 |
def create_main_interface():
|
| 572 |
"""๋ฉ์ธ ์ธํฐํ์ด์ค ์์ฑ ํจ์"""
|
|
|
|
| 687 |
with open('app.css', 'r', encoding='utf-8') as f:
|
| 688 |
custom_css = f.read()
|
| 689 |
|
| 690 |
+
custom_css = """
|
| 691 |
+
/* ์ ์ฒด ์ปจํ
์ด๋ */
|
| 692 |
+
.container {
|
| 693 |
+
max-width: 1400px;
|
| 694 |
+
margin: 0 auto;
|
| 695 |
+
padding: 20px;
|
| 696 |
+
}
|
|
|
|
| 697 |
|
| 698 |
+
/* ๋ฉ์ธ ๋ ์ด์์ */
|
| 699 |
+
.main-tabs {
|
| 700 |
+
display: flex;
|
| 701 |
+
gap: 30px;
|
| 702 |
+
min-height: 90vh;
|
| 703 |
+
background: #f5f7fa;
|
| 704 |
+
border-radius: 20px;
|
| 705 |
+
padding: 30px;
|
| 706 |
+
box-shadow: 0 10px 40px rgba(0,0,0,0.1);
|
| 707 |
+
}
|
| 708 |
|
| 709 |
+
/* ์ข์ธก ํจ๋ */
|
| 710 |
+
.left-panel {
|
| 711 |
+
flex: 1;
|
| 712 |
+
background: white;
|
| 713 |
+
border-radius: 15px;
|
| 714 |
+
padding: 25px;
|
| 715 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
| 716 |
+
display: flex;
|
| 717 |
+
flex-direction: column;
|
| 718 |
+
gap: 20px;
|
| 719 |
+
}
|
| 720 |
|
| 721 |
+
/* ์ฐ์ธก ํจ๋ */
|
| 722 |
+
.right-panel {
|
| 723 |
+
flex: 2;
|
| 724 |
+
background: white;
|
| 725 |
+
border-radius: 15px;
|
| 726 |
+
padding: 25px;
|
| 727 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
| 728 |
+
}
|
| 729 |
|
| 730 |
+
/* ๋ชจ๋ ์ ํ๊ธฐ */
|
| 731 |
+
.mode-selector {
|
| 732 |
+
background: #f8f9fa;
|
| 733 |
+
padding: 20px;
|
| 734 |
+
border-radius: 12px;
|
| 735 |
+
border: 1px solid #e0e5ec;
|
| 736 |
+
}
|
| 737 |
|
| 738 |
+
/* ์
๋ ฅ ์์ญ */
|
| 739 |
+
.input-area {
|
| 740 |
+
display: flex;
|
| 741 |
+
flex-direction: column;
|
| 742 |
+
gap: 15px;
|
| 743 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 744 |
|
| 745 |
+
.custom-textarea {
|
| 746 |
+
min-height: 200px !important;
|
| 747 |
+
padding: 20px !important;
|
| 748 |
+
border: 2px solid #e0e5ec !important;
|
| 749 |
+
border-radius: 12px !important;
|
| 750 |
+
font-size: 16px !important;
|
| 751 |
+
line-height: 1.6 !important;
|
| 752 |
+
resize: vertical !important;
|
| 753 |
+
transition: all 0.3s ease !important;
|
| 754 |
+
}
|
| 755 |
|
| 756 |
+
.custom-textarea:focus {
|
| 757 |
+
border-color: #007aff !important;
|
| 758 |
+
box-shadow: 0 0 0 3px rgba(0,122,255,0.1) !important;
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
/* ๋ฒํผ ๊ทธ๋ฃน */
|
| 762 |
+
.button-group {
|
| 763 |
+
display: flex;
|
| 764 |
+
gap: 12px;
|
| 765 |
+
margin-top: 20px;
|
| 766 |
+
}
|
| 767 |
+
|
| 768 |
+
.generate-btn {
|
| 769 |
+
background: linear-gradient(45deg, #007aff, #00a2ff) !important;
|
| 770 |
+
color: white !important;
|
| 771 |
+
padding: 12px 24px !important;
|
| 772 |
+
border-radius: 10px !important;
|
| 773 |
+
font-weight: 600 !important;
|
| 774 |
+
border: none !important;
|
| 775 |
+
box-shadow: 0 4px 15px rgba(0,122,255,0.3) !important;
|
| 776 |
+
transition: all 0.3s ease !important;
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
.enhance-btn {
|
| 780 |
+
background: white !important;
|
| 781 |
+
color: #007aff !important;
|
| 782 |
+
padding: 12px 24px !important;
|
| 783 |
+
border-radius: 10px !important;
|
| 784 |
+
font-weight: 600 !important;
|
| 785 |
+
border: 2px solid #007aff !important;
|
| 786 |
+
transition: all 0.3s ease !important;
|
| 787 |
+
}
|
| 788 |
+
|
| 789 |
+
.share-btn {
|
| 790 |
+
background: white !important;
|
| 791 |
+
color: #28c840 !important;
|
| 792 |
+
padding: 12px 24px !important;
|
| 793 |
+
border-radius: 10px !important;
|
| 794 |
+
font-weight: 600 !important;
|
| 795 |
+
border: 2px solid #28c840 !important;
|
| 796 |
+
transition: all 0.3s ease !important;
|
| 797 |
+
}
|
| 798 |
+
|
| 799 |
+
/* ๋ฒํผ ํธ๋ฒ ํจ๊ณผ */
|
| 800 |
+
.generate-btn:hover {
|
| 801 |
+
transform: translateY(-2px);
|
| 802 |
+
box-shadow: 0 6px 20px rgba(0,122,255,0.4) !important;
|
| 803 |
+
}
|
| 804 |
+
|
| 805 |
+
.enhance-btn:hover {
|
| 806 |
+
background: rgba(0,122,255,0.1) !important;
|
| 807 |
+
transform: translateY(-2px);
|
| 808 |
+
}
|
| 809 |
+
|
| 810 |
+
.share-btn:hover {
|
| 811 |
+
background: rgba(40,200,64,0.1) !important;
|
| 812 |
+
transform: translateY(-2px);
|
| 813 |
+
}
|
| 814 |
+
|
| 815 |
+
/* ํ๋ฆฌ๋ทฐ ์์ญ */
|
| 816 |
+
.preview-container {
|
| 817 |
+
background: white;
|
| 818 |
+
border-radius: 15px;
|
| 819 |
+
overflow: hidden;
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
.preview-header {
|
| 823 |
+
background: #f8f9fa;
|
| 824 |
+
padding: 15px;
|
| 825 |
+
border-bottom: 1px solid #e0e5ec;
|
| 826 |
+
display: flex;
|
| 827 |
+
align-items: center;
|
| 828 |
+
gap: 15px;
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
.window-controls {
|
| 832 |
+
display: flex;
|
| 833 |
+
gap: 8px;
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
.control {
|
| 837 |
+
width: 12px;
|
| 838 |
+
height: 12px;
|
| 839 |
+
border-radius: 50%;
|
| 840 |
+
transition: all 0.3s ease;
|
| 841 |
+
}
|
| 842 |
+
|
| 843 |
+
.close { background: #ff5f57; }
|
| 844 |
+
.minimize { background: #febc2e; }
|
| 845 |
+
.maximize { background: #28c840; }
|
| 846 |
|
| 847 |
+
.preview-content {
|
| 848 |
+
padding: 25px;
|
| 849 |
+
min-height: 500px;
|
| 850 |
+
}
|
| 851 |
+
|
| 852 |
+
/* ๊ฒฐ๊ณผ ์์ญ */
|
| 853 |
+
.result-area {
|
| 854 |
+
background: #f8f9fa;
|
| 855 |
+
border-radius: 12px;
|
| 856 |
+
padding: 20px;
|
| 857 |
+
margin-top: 20px;
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
/* ๋ก๋ฉ ์ํ */
|
| 861 |
+
.loading-container {
|
| 862 |
+
display: flex;
|
| 863 |
+
flex-direction: column;
|
| 864 |
+
align-items: center;
|
| 865 |
+
justify-content: center;
|
| 866 |
+
padding: 40px;
|
| 867 |
+
gap: 20px;
|
| 868 |
+
}
|
| 869 |
+
|
| 870 |
+
/* ๋ฐ์ํ ๋์์ธ */
|
| 871 |
+
@media (max-width: 1200px) {
|
| 872 |
+
.main-tabs {
|
| 873 |
+
flex-direction: column;
|
| 874 |
}
|
| 875 |
+
|
| 876 |
+
.left-panel, .right-panel {
|
| 877 |
+
width: 100%;
|
| 878 |
+
}
|
| 879 |
+
}
|
| 880 |
"""
|
|
|
|
| 881 |
|
| 882 |
+
demo = gr.Blocks(css=custom_css, theme=theme)
|
| 883 |
|
| 884 |
with demo:
|
| 885 |
+
with gr.Row(elem_classes="container"):
|
| 886 |
+
with gr.Column(elem_classes="main-tabs"):
|
| 887 |
+
# ์ข์ธก ํจ๋
|
| 888 |
+
with gr.Column(scale=1, elem_classes="left-panel"):
|
| 889 |
+
mode = gr.Radio(
|
| 890 |
+
choices=["Generate", "Generate + Web Search"],
|
| 891 |
+
label="Mode",
|
| 892 |
+
value="Generate",
|
| 893 |
+
info="Select mode for content generation",
|
| 894 |
+
elem_classes="mode-selector"
|
| 895 |
+
)
|
| 896 |
+
|
| 897 |
+
with gr.Column(elem_classes="input-area"):
|
| 898 |
+
input = gr.Textbox(
|
| 899 |
+
label="Enter your prompt",
|
| 900 |
+
placeholder="Type your request here...",
|
| 901 |
+
lines=8,
|
| 902 |
+
elem_classes="custom-textarea"
|
| 903 |
+
)
|
| 904 |
+
|
| 905 |
+
with gr.Row(elem_classes="button-group"):
|
| 906 |
+
btn = gr.Button("Generate", elem_classes="generate-btn")
|
| 907 |
+
boost_btn = gr.Button("Enhance", elem_classes="enhance-btn")
|
| 908 |
+
deploy_btn = gr.Button("Share", elem_classes="share-btn")
|
| 909 |
+
|
| 910 |
+
deploy_result = gr.HTML(
|
| 911 |
+
label="Share Result",
|
| 912 |
+
elem_classes="result-area"
|
| 913 |
+
)
|
| 914 |
+
|
| 915 |
+
# ์ฐ์ธก ํจ๋
|
| 916 |
+
with gr.Column(scale=2, elem_classes="right-panel"):
|
| 917 |
+
with gr.Column(elem_classes="preview-container"):
|
| 918 |
+
gr.HTML("""
|
| 919 |
+
<div class="preview-header">
|
| 920 |
<div class="window-controls">
|
| 921 |
<div class="control close"></div>
|
| 922 |
<div class="control minimize"></div>
|
| 923 |
<div class="control maximize"></div>
|
| 924 |
</div>
|
| 925 |
+
<div>Preview</div>
|
| 926 |
</div>
|
| 927 |
+
""")
|
| 928 |
+
|
| 929 |
+
with gr.Tabs() as state_tab:
|
| 930 |
+
with gr.Tab("empty"):
|
| 931 |
+
gr.Markdown("Enter your prompt to begin", elem_classes="preview-content")
|
| 932 |
+
with gr.Tab("loading"):
|
| 933 |
+
with gr.Column(elem_classes="loading-container"):
|
| 934 |
+
gr.Markdown("Creating visual presentation...")
|
| 935 |
+
with gr.Tab("render"):
|
| 936 |
+
sandbox = gr.HTML(elem_classes="preview-content")
|
| 937 |
+
with gr.Tab("error"):
|
| 938 |
+
gr.Markdown("An error occurred. Please try again.", elem_classes="preview-content")
|
|
|
|
| 939 |
|
| 940 |
# ์ํ ๋ณ์๋ค
|
| 941 |
setting = gr.State({"system": SystemPrompt})
|
| 942 |
search_mode = gr.State(False)
|
| 943 |
code_output = gr.State("")
|
| 944 |
|
| 945 |
+
# ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
| 946 |
+
mode.change(
|
| 947 |
+
fn=lambda x: x == "Generate + Web Search",
|
| 948 |
+
inputs=[mode],
|
| 949 |
+
outputs=[search_mode]
|
| 950 |
+
)
|
| 951 |
+
|
| 952 |
+
btn.click(
|
| 953 |
+
fn=handle_generation,
|
| 954 |
+
inputs=[input, setting, search_mode],
|
| 955 |
+
outputs=[code_output, sandbox, state_tab, code_drawer]
|
| 956 |
+
).then(
|
| 957 |
+
fn=update_placeholder,
|
| 958 |
+
inputs=[],
|
| 959 |
+
outputs=[input]
|
| 960 |
+
)
|
| 961 |
+
|
| 962 |
+
boost_btn.click(
|
| 963 |
+
fn=handle_boost,
|
| 964 |
+
inputs=[input],
|
| 965 |
+
outputs=[input, state_tab]
|
| 966 |
+
)
|
| 967 |
+
|
| 968 |
+
deploy_btn.click(
|
| 969 |
+
fn=lambda code: deploy_to_vercel(remove_code_block(code)) if code else "No code to share.",
|
| 970 |
+
inputs=[code_output],
|
| 971 |
+
outputs=[deploy_result]
|
| 972 |
+
)
|
| 973 |
|
| 974 |
return demo
|
| 975 |
|