Spaces:
Sleeping
Sleeping
Update App.py
Browse filesSwitched model 2 to gemma 3, made it look wayy better
App.py
CHANGED
|
@@ -338,7 +338,7 @@ class ModelRegistry:
|
|
| 338 |
{"name": "Claude 3 Haiku", "id": "claude-3-haiku-20240307", "provider": "anthropic", "type": ["solver"], "icon": "📜"}
|
| 339 |
],
|
| 340 |
"OpenAI": [
|
| 341 |
-
{"name": "GPT-4o", "id": "gpt-4o", "provider": "openai", "type": ["solver"], "icon": "
|
| 342 |
{"name": "GPT-4 Turbo", "id": "gpt-4-turbo", "provider": "openai", "type": ["solver"], "icon": "🤖"},
|
| 343 |
{"name": "GPT-4", "id": "gpt-4", "provider": "openai", "type": ["solver"], "icon": "🤖"},
|
| 344 |
{"name": "GPT-3.5 Turbo", "id": "gpt-3.5-turbo", "provider": "openai", "type": ["solver"], "icon": "🤖"},
|
|
@@ -602,105 +602,55 @@ class PolyThinkOrchestrator:
|
|
| 602 |
# --- Gradio Interface ---
|
| 603 |
def create_polythink_interface():
|
| 604 |
custom_css = """
|
| 605 |
-
/*
|
| 606 |
body {
|
| 607 |
background: #000000;
|
| 608 |
color: #ffffff;
|
| 609 |
font-family: 'Arial', sans-serif;
|
|
|
|
|
|
|
|
|
|
| 610 |
}
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
|
|
|
|
|
|
|
|
|
| 615 |
padding: 20px;
|
| 616 |
}
|
| 617 |
-
.gr-button {
|
| 618 |
-
background: linear-gradient(45deg, #666666, #999999);
|
| 619 |
-
color: #ffffff;
|
| 620 |
-
border: none;
|
| 621 |
-
padding: 10px 20px;
|
| 622 |
-
border-radius: 5px;
|
| 623 |
-
transition: all 0.3s ease;
|
| 624 |
-
}
|
| 625 |
-
.gr-button:hover {
|
| 626 |
-
background: linear-gradient(45deg, #555555, #888888);
|
| 627 |
-
transform: translateY(-2px);
|
| 628 |
-
}
|
| 629 |
-
.gr-textbox {
|
| 630 |
-
background: #333333;
|
| 631 |
-
color: #ffffff;
|
| 632 |
-
border: 1px solid #444444;
|
| 633 |
-
border-radius: 5px;
|
| 634 |
-
padding: 10px;
|
| 635 |
-
}
|
| 636 |
-
.gr-slider {
|
| 637 |
-
background: #333333;
|
| 638 |
-
border-radius: 5px;
|
| 639 |
-
}
|
| 640 |
-
.gr-slider .track-fill {
|
| 641 |
-
background: #cccccc;
|
| 642 |
-
}
|
| 643 |
-
.step-section {
|
| 644 |
-
background: #1a1a1a;
|
| 645 |
-
border-radius: 8px;
|
| 646 |
-
padding: 15px;
|
| 647 |
-
margin-bottom: 20px;
|
| 648 |
-
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
|
| 649 |
-
}
|
| 650 |
-
.step-section h3 {
|
| 651 |
-
color: #cccccc;
|
| 652 |
-
margin-top: 0;
|
| 653 |
-
font-size: 1.5em;
|
| 654 |
-
}
|
| 655 |
-
.step-section p {
|
| 656 |
-
color: #aaaaaa;
|
| 657 |
-
line-height: 1.6;
|
| 658 |
-
}
|
| 659 |
-
.step-section code {
|
| 660 |
-
background: #333333;
|
| 661 |
-
padding: 2px 6px;
|
| 662 |
-
border-radius: 3px;
|
| 663 |
-
color: #ff6b6b;
|
| 664 |
-
}
|
| 665 |
-
.step-section strong {
|
| 666 |
-
color: #ffffff;
|
| 667 |
-
}
|
| 668 |
-
.status-bar {
|
| 669 |
-
background: #1a1a1a;
|
| 670 |
-
padding: 10px;
|
| 671 |
-
border-radius: 5px;
|
| 672 |
-
font-size: 1.1em;
|
| 673 |
-
margin-bottom: 20px;
|
| 674 |
-
border-left: 4px solid #666666;
|
| 675 |
-
}
|
| 676 |
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
}
|
| 685 |
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
background-color: rgba(244, 67, 54, 0.1) !important;
|
| 690 |
-
padding: 10px;
|
| 691 |
-
border-radius: 5px;
|
| 692 |
}
|
| 693 |
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
overflow: hidden;
|
| 702 |
}
|
| 703 |
|
|
|
|
| 704 |
.final-report-container {
|
| 705 |
font-family: 'Arial', sans-serif;
|
| 706 |
}
|
|
@@ -821,6 +771,23 @@ def create_polythink_interface():
|
|
| 821 |
color: #bbbbbb;
|
| 822 |
}
|
| 823 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 824 |
.judgment-container {
|
| 825 |
display: flex;
|
| 826 |
align-items: center;
|
|
@@ -857,48 +824,6 @@ def create_polythink_interface():
|
|
| 857 |
margin: 5px 0;
|
| 858 |
}
|
| 859 |
|
| 860 |
-
/* Header styling */
|
| 861 |
-
.app-header {
|
| 862 |
-
background: linear-gradient(45deg, #222222, #333333);
|
| 863 |
-
padding: 20px;
|
| 864 |
-
border-radius: 10px;
|
| 865 |
-
margin-bottom: 20px;
|
| 866 |
-
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
| 867 |
-
border: 1px solid #444444;
|
| 868 |
-
}
|
| 869 |
-
|
| 870 |
-
.app-title {
|
| 871 |
-
font-size: 28px;
|
| 872 |
-
margin: 0 0 10px 0;
|
| 873 |
-
background: -webkit-linear-gradient(45deg, #cccccc, #ffffff);
|
| 874 |
-
-webkit-background-clip: text;
|
| 875 |
-
-webkit-text-fill-color: transparent;
|
| 876 |
-
display: inline-block;
|
| 877 |
-
}
|
| 878 |
-
|
| 879 |
-
.app-subtitle {
|
| 880 |
-
font-size: 16px;
|
| 881 |
-
color: #aaaaaa;
|
| 882 |
-
margin: 0;
|
| 883 |
-
}
|
| 884 |
-
|
| 885 |
-
/* Button style */
|
| 886 |
-
.primary-button {
|
| 887 |
-
background: linear-gradient(45deg, #555555, #777777) !important;
|
| 888 |
-
border: none !important;
|
| 889 |
-
color: white !important;
|
| 890 |
-
padding: 12px 24px !important;
|
| 891 |
-
font-weight: bold !important;
|
| 892 |
-
transition: all 0.3s ease !important;
|
| 893 |
-
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
|
| 894 |
-
}
|
| 895 |
-
|
| 896 |
-
.primary-button:hover {
|
| 897 |
-
transform: translateY(-2px) !important;
|
| 898 |
-
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4) !important;
|
| 899 |
-
background: linear-gradient(45deg, #666666, #888888) !important;
|
| 900 |
-
}
|
| 901 |
-
|
| 902 |
/* Best Answer styling */
|
| 903 |
.best-answer-container {
|
| 904 |
background: #1a1a1a;
|
|
@@ -939,6 +864,50 @@ def create_polythink_interface():
|
|
| 939 |
.best-answer-text strong {
|
| 940 |
color: #4CAF50;
|
| 941 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 942 |
"""
|
| 943 |
|
| 944 |
# Hardcoded model configurations
|
|
@@ -949,9 +918,9 @@ def create_polythink_interface():
|
|
| 949 |
}
|
| 950 |
|
| 951 |
solver2_config = {
|
| 952 |
-
"name": "
|
| 953 |
-
"id": "
|
| 954 |
-
"provider": "
|
| 955 |
}
|
| 956 |
|
| 957 |
judge_config = {
|
|
@@ -968,7 +937,7 @@ def create_polythink_interface():
|
|
| 968 |
cohere_key = os.getenv("COHERE_API_KEY")
|
| 969 |
if cohere_key:
|
| 970 |
api_clients["cohere"] = cohere.Client(cohere_key)
|
| 971 |
-
|
| 972 |
# Hugging Face client
|
| 973 |
hf_key = os.getenv("HF_API_KEY")
|
| 974 |
if hf_key:
|
|
@@ -1087,10 +1056,24 @@ def create_polythink_interface():
|
|
| 1087 |
gr.update(value=f"### Status: ✨ Process complete! Completed {round_num + 1} round(s)", visible=True)
|
| 1088 |
]
|
| 1089 |
|
| 1090 |
-
|
| 1091 |
-
|
| 1092 |
-
|
| 1093 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1094 |
|
| 1095 |
with gr.Row():
|
| 1096 |
with gr.Column(scale=2):
|
|
|
|
| 338 |
{"name": "Claude 3 Haiku", "id": "claude-3-haiku-20240307", "provider": "anthropic", "type": ["solver"], "icon": "📜"}
|
| 339 |
],
|
| 340 |
"OpenAI": [
|
| 341 |
+
{"name": "GPT-4o", "id": "gpt-4o", "provider": "openai", "type": ["solver"], "icon": "🤖"},
|
| 342 |
{"name": "GPT-4 Turbo", "id": "gpt-4-turbo", "provider": "openai", "type": ["solver"], "icon": "🤖"},
|
| 343 |
{"name": "GPT-4", "id": "gpt-4", "provider": "openai", "type": ["solver"], "icon": "🤖"},
|
| 344 |
{"name": "GPT-3.5 Turbo", "id": "gpt-3.5-turbo", "provider": "openai", "type": ["solver"], "icon": "🤖"},
|
|
|
|
| 602 |
# --- Gradio Interface ---
|
| 603 |
def create_polythink_interface():
|
| 604 |
custom_css = """
|
| 605 |
+
/* Solid black background */
|
| 606 |
body {
|
| 607 |
background: #000000;
|
| 608 |
color: #ffffff;
|
| 609 |
font-family: 'Arial', sans-serif;
|
| 610 |
+
margin: 0;
|
| 611 |
+
padding: 0;
|
| 612 |
+
min-height: 100vh;
|
| 613 |
}
|
| 614 |
+
|
| 615 |
+
footer {visibility: hidden}
|
| 616 |
+
|
| 617 |
+
/* Enhanced heading without the green light */
|
| 618 |
+
.polythink-header {
|
| 619 |
+
text-align: center;
|
| 620 |
+
margin-bottom: 30px;
|
| 621 |
padding: 20px;
|
| 622 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 623 |
|
| 624 |
+
.polythink-title {
|
| 625 |
+
font-size: 48px;
|
| 626 |
+
font-weight: 800;
|
| 627 |
+
margin: 0;
|
| 628 |
+
padding: 0;
|
| 629 |
+
background: linear-gradient(90deg, #ffffff, #aaaaaa, #ffffff);
|
| 630 |
+
-webkit-background-clip: text;
|
| 631 |
+
background-clip: text;
|
| 632 |
+
-webkit-text-fill-color: transparent;
|
| 633 |
+
animation: shine 3s linear infinite;
|
| 634 |
+
text-transform: uppercase;
|
| 635 |
+
letter-spacing: 3px;
|
| 636 |
+
text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
|
| 637 |
}
|
| 638 |
|
| 639 |
+
@keyframes shine {
|
| 640 |
+
0% {background-position: 0%;}
|
| 641 |
+
100% {background-position: 200%;}
|
|
|
|
|
|
|
|
|
|
| 642 |
}
|
| 643 |
|
| 644 |
+
.polythink-subtitle {
|
| 645 |
+
font-size: 18px;
|
| 646 |
+
color: #cccccc;
|
| 647 |
+
margin: 10px 0 0 0;
|
| 648 |
+
text-transform: uppercase;
|
| 649 |
+
letter-spacing: 2px;
|
| 650 |
+
font-weight: 300;
|
|
|
|
| 651 |
}
|
| 652 |
|
| 653 |
+
/* Original Final Report Styling */
|
| 654 |
.final-report-container {
|
| 655 |
font-family: 'Arial', sans-serif;
|
| 656 |
}
|
|
|
|
| 771 |
color: #bbbbbb;
|
| 772 |
}
|
| 773 |
|
| 774 |
+
/* Keep green highlights for agreement/disagreement */
|
| 775 |
+
.agreement {
|
| 776 |
+
color: #4CAF50 !important;
|
| 777 |
+
border: 1px solid #4CAF50;
|
| 778 |
+
background-color: rgba(76, 175, 80, 0.1) !important;
|
| 779 |
+
padding: 10px;
|
| 780 |
+
border-radius: 5px;
|
| 781 |
+
}
|
| 782 |
+
|
| 783 |
+
.disagreement {
|
| 784 |
+
color: #F44336 !important;
|
| 785 |
+
border: 1px solid #F44336;
|
| 786 |
+
background-color: rgba(244, 67, 54, 0.1) !important;
|
| 787 |
+
padding: 10px;
|
| 788 |
+
border-radius: 5px;
|
| 789 |
+
}
|
| 790 |
+
|
| 791 |
.judgment-container {
|
| 792 |
display: flex;
|
| 793 |
align-items: center;
|
|
|
|
| 824 |
margin: 5px 0;
|
| 825 |
}
|
| 826 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 827 |
/* Best Answer styling */
|
| 828 |
.best-answer-container {
|
| 829 |
background: #1a1a1a;
|
|
|
|
| 864 |
.best-answer-text strong {
|
| 865 |
color: #4CAF50;
|
| 866 |
}
|
| 867 |
+
|
| 868 |
+
/* Gradio container */
|
| 869 |
+
.gradio-container {
|
| 870 |
+
background: #1a1a1a;
|
| 871 |
+
border-radius: 10px;
|
| 872 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
|
| 873 |
+
padding: 20px;
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
+
/* Status bar styling */
|
| 877 |
+
.status-bar {
|
| 878 |
+
background: #1a1a1a;
|
| 879 |
+
padding: 10px;
|
| 880 |
+
border-radius: 5px;
|
| 881 |
+
font-size: 1.1em;
|
| 882 |
+
margin-bottom: 20px;
|
| 883 |
+
border-left: 4px solid #666666;
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
/* Step section styling */
|
| 887 |
+
.step-section {
|
| 888 |
+
background: #1a1a1a;
|
| 889 |
+
border-radius: 8px;
|
| 890 |
+
padding: 15px;
|
| 891 |
+
margin-bottom: 20px;
|
| 892 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
/* Primary button */
|
| 896 |
+
.primary-button {
|
| 897 |
+
background: linear-gradient(45deg, #555555, #777777) !important;
|
| 898 |
+
border: none !important;
|
| 899 |
+
color: white !important;
|
| 900 |
+
padding: 12px 24px !important;
|
| 901 |
+
font-weight: bold !important;
|
| 902 |
+
transition: all 0.3s ease !important;
|
| 903 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
|
| 904 |
+
}
|
| 905 |
+
|
| 906 |
+
.primary-button:hover {
|
| 907 |
+
transform: translateY(-2px) !important;
|
| 908 |
+
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4) !important;
|
| 909 |
+
background: linear-gradient(45deg, #666666, #888888) !important;
|
| 910 |
+
}
|
| 911 |
"""
|
| 912 |
|
| 913 |
# Hardcoded model configurations
|
|
|
|
| 918 |
}
|
| 919 |
|
| 920 |
solver2_config = {
|
| 921 |
+
"name": "Gemma 3 27B",
|
| 922 |
+
"id": "gemma-3-27b-it",
|
| 923 |
+
"provider": "gemini"
|
| 924 |
}
|
| 925 |
|
| 926 |
judge_config = {
|
|
|
|
| 937 |
cohere_key = os.getenv("COHERE_API_KEY")
|
| 938 |
if cohere_key:
|
| 939 |
api_clients["cohere"] = cohere.Client(cohere_key)
|
| 940 |
+
|
| 941 |
# Hugging Face client
|
| 942 |
hf_key = os.getenv("HF_API_KEY")
|
| 943 |
if hf_key:
|
|
|
|
| 1056 |
gr.update(value=f"### Status: ✨ Process complete! Completed {round_num + 1} round(s)", visible=True)
|
| 1057 |
]
|
| 1058 |
|
| 1059 |
+
# Apply Monochrome theme and customize it
|
| 1060 |
+
theme = gr.themes.Monochrome(
|
| 1061 |
+
primary_hue="slate",
|
| 1062 |
+
secondary_hue="gray",
|
| 1063 |
+
neutral_hue="neutral",
|
| 1064 |
+
).set(
|
| 1065 |
+
body_text_color="white",
|
| 1066 |
+
background_fill_secondary="rgba(26, 26, 26, 0.9)",
|
| 1067 |
+
background_fill_primary="rgba(0, 0, 0, 0)",
|
| 1068 |
+
)
|
| 1069 |
+
|
| 1070 |
+
with gr.Blocks(title="PolyThink Alpha", css=custom_css, theme=theme) as demo:
|
| 1071 |
+
# Enhanced header section
|
| 1072 |
+
with gr.Column(elem_classes=["polythink-header"]):
|
| 1073 |
+
gr.HTML("""
|
| 1074 |
+
<h1 class='polythink-title'>PolyThink</h1>
|
| 1075 |
+
<p class='polythink-subtitle'>Multi-Agent Problem Solving System</p>
|
| 1076 |
+
""", show_label=False)
|
| 1077 |
|
| 1078 |
with gr.Row():
|
| 1079 |
with gr.Column(scale=2):
|