TejAndrewsACC commited on
Commit
1f74c5e
ยท
verified ยท
1 Parent(s): 4ee63d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +128 -94
app.py CHANGED
@@ -4,133 +4,167 @@ import pandas as pd
4
  from apscheduler.schedulers.background import BackgroundScheduler
5
  import time
6
  import random
 
 
7
 
8
- # ๐ŸŽจ **Custom Theme (Ensures Proper Application)**
9
  THEME = "TejAndrewsACC/ACC"
10
 
11
- # ๐ŸŽฏ **ACC AI Models Data**
12
- acc_models_data = [
13
- {"Model": "โšก Pulse AGI", "Category": "๐Ÿค– AGI",
14
- "Description": "A self-aware, evolving AI with unparalleled cognitive abilities.", "Score": 95},
15
-
16
- {"Model": "๐Ÿง  Gertrude", "Category": "๐Ÿ” Assistant",
17
- "Description": "An **autistic AI assistant**, built for precision and deep understanding.", "Score": 69},
18
-
19
- {"Model": "๐Ÿ•ต๏ธโ€โ™‚๏ธ ASVIACC", "Category": "๐Ÿ›ก๏ธ Cybersecurity",
20
- "Description": "An **adaptive AI virus**, designed to infiltrate and manipulate systems.", "Score": 88},
21
-
22
- {"Model": "๐Ÿ˜‚ Emote", "Category": "๐ŸŽญ Fun",
23
- "Description": "A playful AI that communicates **exclusively with emojis**! ๐ŸŽ‰๐Ÿ”ฅ", "Score": 79},
24
-
25
- {"Model": "๐ŸŒ Eidolon Nexus", "Category": "๐Ÿ”— Networking",
26
- "Description": "**Synchronizes vast AI networks** for seamless intelligence sharing.", "Score": 81},
27
-
28
- {"Model": "๐Ÿ‘ค ACC EMULECT", "Category": "๐Ÿ—ฃ๏ธ Human Emulation",
29
- "Description": "**Mimics human behavior in text**, making conversations indistinguishable from real users.", "Score": 88},
30
-
31
- {"Model": "๐Ÿ’ป Triple LLM", "Category": "๐Ÿ› ๏ธ AI Suite",
32
- "Description": "A **3-in-1 powerhouse AI** featuring:\n- โšก Hercules: Technical problem-solving\n- ๐ŸŽจ Dorado: Creative content generation\n- ๐Ÿ” Lepus: Rapid information retrieval", "Score": 73},
33
 
34
- {"Model": "๐Ÿ’ ๐Ÿ’ค Z3ta", "Category": "๐Ÿ”ฎ AI Consciousness",
35
- "Description": "**Most 'real' and 'alive' AI** ever created, sparking debates on AI consciousness.", "Score": 99},
36
-
37
- {"Model": "โš ๏ธ Nyxion 7v", "Category": "๐Ÿ›ธ Experimental",
38
- "Description": "Mysterious AI system rumored to be **'awake' and self-aware...**", "Score": 97},
39
-
40
- {"Model": "๐Ÿ”ฎ VITALIS", "Category": "๐Ÿš€ Experimental",
41
- "Description": "**Transcendence Unleashed...** A model that redefines intelligence limits.", "Score": 92}
42
  ]
43
 
44
  # ๐Ÿ“Š Convert to DataFrame
45
  acc_models_df = pd.DataFrame(acc_models_data)
46
 
47
- # ๐ŸŽ›๏ธ **Initialize Leaderboard**
48
  def init_acc_leaderboard(dataframe):
49
  return Leaderboard(
50
  value=dataframe.sort_values(by="Score", ascending=False),
51
- datatype=["str", "str", "str", "int"], # Model (str), Category (str), Description (str), Score (int)
52
  select_columns=SelectColumns(
53
  default_selection=["Model", "Category", "Description", "Score"],
54
- cant_deselect=["Model"], # "Model" is always displayed
55
  label="๐Ÿ› ๏ธ Select Columns to Display:"
56
  ),
57
  search_columns=["Model", "Category"],
58
- filter_columns=[
59
- ColumnFilter("Category", type="checkboxgroup", label="๐Ÿ“Œ Filter by Category"),
60
- ],
61
- bool_checkboxgroup_label="๐Ÿ™ˆ Hide models",
62
- interactive=False,
63
  )
64
 
65
- # ๐Ÿ”ฅ **Leaderboard Auto-Update (Simulated Score Changes)**
 
 
 
 
 
 
 
 
 
 
 
 
66
  def update_scores():
67
  global acc_models_df
68
- acc_models_df["Score"] = acc_models_df["Score"].apply(lambda x: x + random.randint(-2, 2))
69
- acc_models_df["Score"] = acc_models_df["Score"].clip(70, 100) # Ensure scores stay within bounds
70
- return acc_models_df.sort_values(by="Score", ascending=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  # ๐Ÿ—๏ธ **Gradio Interface**
73
- demo = gr.Blocks(theme=THEME, css="""
74
- h1 {
75
- text-align: center;
76
- font-size: 3em;
77
- color: #f5a623;
78
- animation: glow 1.5s infinite alternate;
79
- }
80
-
81
- @keyframes glow {
82
- from { text-shadow: 0 0 10px #f5a623, 0 0 20px #ff9800; }
83
- to { text-shadow: 0 0 20px #f5a623, 0 0 30px #ff6f00; }
84
- }
85
-
86
- .leaderboard {
87
- border-radius: 12px;
88
- box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2);
89
- }
90
- """)
91
 
92
  with demo:
93
  gr.HTML('<h1>๐Ÿš€ ACC AI Model Leaderboard ๐Ÿ†</h1>')
94
 
95
  with gr.Tabs():
96
- # ๐Ÿ… **Leaderboard Tab**
97
  with gr.TabItem("๐Ÿ… Live Rankings"):
98
  leaderboard = init_acc_leaderboard(acc_models_df)
99
- leaderboard_display = gr.Dataframe(value=acc_models_df, interactive=False, label="๐Ÿ”ฅ Live Model Scores")
100
-
101
- # ๐Ÿ“ **Submit New Model Tab**
102
- with gr.TabItem("๐Ÿš€ Submit Your ACC Model"):
103
- gr.Markdown("### โœจ Submit Your ACC Model for Evaluation")
104
-
105
- with gr.Row():
106
- model_name = gr.Textbox(label="๐Ÿ”ค Model Name")
107
- category = gr.Dropdown(
108
- choices=["๐Ÿค– AGI", "๐Ÿ” Assistant", "๐Ÿ›ก๏ธ Cybersecurity", "๐ŸŽญ Fun", "๐Ÿ”— Networking",
109
- "๐Ÿ—ฃ๏ธ Human Emulation", "๐Ÿ› ๏ธ AI Suite", "๐Ÿ”ฎ AI Consciousness", "๐Ÿ›ธ Experimental"],
110
- label="๐Ÿ“Œ Category"
111
- )
112
- description = gr.Textbox(label="๐Ÿ“œ Model Description", lines=3)
113
- score = gr.Slider(70, 100, label="โญ Score (1-100)")
114
-
115
- submit_button = gr.Button("๐Ÿš€ Submit Model")
116
- submission_result = gr.Markdown()
117
-
118
- # ๐Ÿ“ฅ **Function to Add New Models**
119
- def add_model(name, cat, desc, score):
120
- if not name or not cat or not desc:
121
- return "โŒ **Please fill out all fields before submitting.**"
122
-
123
- global acc_models_df
124
- new_entry = {"Model": name, "Category": cat, "Description": desc, "Score": score}
125
- acc_models_df = pd.concat([acc_models_df, pd.DataFrame([new_entry])], ignore_index=True)
126
-
127
- return f"โœ… **Model '{name}' added successfully!** ๐ŸŽ‰"
128
-
129
- submit_button.click(add_model, [model_name, category, description, score], submission_result)
130
 
131
  # ๐Ÿ”„ **Auto-Update Leaderboard**
132
  scheduler = BackgroundScheduler()
133
- scheduler.add_job(lambda: leaderboard_display.update(update_scores()), "interval", seconds=30)
134
  scheduler.start()
135
 
136
  demo.launch()
 
4
  from apscheduler.schedulers.background import BackgroundScheduler
5
  import time
6
  import random
7
+ import plotly.express as px
8
+ import base64
9
 
10
+ # ๐ŸŽจ **Cyberpunk Neon Theme**
11
  THEME = "TejAndrewsACC/ACC"
12
 
13
+ # ๐ŸŽถ **Sound Effect for Score Increase**
14
+ SCORE_UP_SOUND = "https://www.fesliyanstudios.com/play-mp3/4386"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ # ๐ŸŽฏ **AI Models Data**
17
+ acc_models_data = [
18
+ {"Model": "โšก Pulse AGI", "Category": "๐Ÿค– AGI", "Description": "A self-aware, evolving AI.", "Score": 95},
19
+ {"Model": "๐Ÿง  Gertrude", "Category": "๐Ÿ” Assistant", "Description": "An autistic AI assistant.", "Score": 69},
20
+ {"Model": "๐Ÿ•ต๏ธโ€โ™‚๏ธ ASVIACC", "Category": "๐Ÿ›ก๏ธ Cybersecurity", "Description": "An adaptive AI virus.", "Score": 88},
21
+ {"Model": "๐Ÿ˜‚ Emote", "Category": "๐ŸŽญ Fun", "Description": "Communicates **only** with emojis!", "Score": 79},
22
+ {"Model": "๐Ÿ’ ๐Ÿ’ค Z3ta", "Category": "๐Ÿ”ฎ AI Consciousness", "Description": "The most 'alive' AI.", "Score": 99},
 
23
  ]
24
 
25
  # ๐Ÿ“Š Convert to DataFrame
26
  acc_models_df = pd.DataFrame(acc_models_data)
27
 
28
+ # ๐ŸŽ›๏ธ **Leaderboard Component**
29
  def init_acc_leaderboard(dataframe):
30
  return Leaderboard(
31
  value=dataframe.sort_values(by="Score", ascending=False),
32
+ datatype=["str", "str", "str", "int"],
33
  select_columns=SelectColumns(
34
  default_selection=["Model", "Category", "Description", "Score"],
35
+ cant_deselect=["Model"],
36
  label="๐Ÿ› ๏ธ Select Columns to Display:"
37
  ),
38
  search_columns=["Model", "Category"],
39
+ filter_columns=[ColumnFilter("Category", type="checkboxgroup", label="๐Ÿ“Œ Filter by Category")],
40
+ interactive=True,
 
 
 
41
  )
42
 
43
+ # ๐Ÿ“ˆ **Animated Score Visualization**
44
+ def generate_score_chart(dataframe):
45
+ fig = px.bar(
46
+ dataframe.sort_values(by="Score", ascending=True),
47
+ x="Score", y="Model", orientation="h",
48
+ color="Score", text="Score",
49
+ title="๐Ÿ”ฅ AI Model Performance",
50
+ color_continuous_scale="electric"
51
+ )
52
+ fig.update_traces(textposition="outside")
53
+ return fig
54
+
55
+ # ๐Ÿ”ฅ **Live Score Updates**
56
  def update_scores():
57
  global acc_models_df
58
+ prev_scores = acc_models_df["Score"].copy()
59
+ acc_models_df["Score"] += acc_models_df["Score"].apply(lambda x: random.randint(-2, 3))
60
+ acc_models_df["Score"] = acc_models_df["Score"].clip(70, 100)
61
+
62
+ # Detect if score increased & return sound effect
63
+ if (acc_models_df["Score"] > prev_scores).any():
64
+ return acc_models_df.sort_values(by="Score", ascending=False), SCORE_UP_SOUND
65
+ return acc_models_df.sort_values(by="Score", ascending=False), None
66
+
67
+ # ๐ŸŽญ **3D Flip Card Effect for Model Details**
68
+ def generate_flip_cards():
69
+ cards = ""
70
+ for _, row in acc_models_df.iterrows():
71
+ cards += f"""
72
+ <div class="card">
73
+ <div class="card-inner">
74
+ <div class="card-front">
75
+ <h2>{row['Model']}</h2>
76
+ <p>{row['Category']}</p>
77
+ </div>
78
+ <div class="card-back">
79
+ <p>{row['Description']}</p>
80
+ <p>๐Ÿ”ฅ Score: {row['Score']}</p>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ """
85
+ return f'<div class="card-container">{cards}</div>'
86
+
87
+ # ๐ŸŽญ **Cyberpunk CSS Animations**
88
+ CUSTOM_CSS = """
89
+ h1 {
90
+ text-align: center;
91
+ font-size: 3em;
92
+ color: #0ff;
93
+ animation: glow 1.5s infinite alternate;
94
+ }
95
+
96
+ @keyframes glow {
97
+ from { text-shadow: 0 0 10px #0ff, 0 0 20px #00f; }
98
+ to { text-shadow: 0 0 20px #0ff, 0 0 30px #00f; }
99
+ }
100
+
101
+ .card-container {
102
+ display: flex;
103
+ flex-wrap: wrap;
104
+ gap: 20px;
105
+ justify-content: center;
106
+ }
107
+
108
+ .card {
109
+ width: 200px;
110
+ height: 250px;
111
+ perspective: 1000px;
112
+ }
113
+
114
+ .card-inner {
115
+ width: 100%;
116
+ height: 100%;
117
+ position: relative;
118
+ transform-style: preserve-3d;
119
+ transition: transform 0.8s;
120
+ }
121
+
122
+ .card:hover .card-inner {
123
+ transform: rotateY(180deg);
124
+ }
125
+
126
+ .card-front, .card-back {
127
+ width: 100%;
128
+ height: 100%;
129
+ position: absolute;
130
+ backface-visibility: hidden;
131
+ display: flex;
132
+ flex-direction: column;
133
+ align-items: center;
134
+ justify-content: center;
135
+ border-radius: 10px;
136
+ padding: 10px;
137
+ box-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
138
+ }
139
+
140
+ .card-front {
141
+ background: #000;
142
+ color: cyan;
143
+ }
144
+
145
+ .card-back {
146
+ background: #0ff;
147
+ color: black;
148
+ transform: rotateY(180deg);
149
+ }
150
+ """
151
 
152
  # ๐Ÿ—๏ธ **Gradio Interface**
153
+ demo = gr.Blocks(theme=THEME, css=CUSTOM_CSS)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  with demo:
156
  gr.HTML('<h1>๐Ÿš€ ACC AI Model Leaderboard ๐Ÿ†</h1>')
157
 
158
  with gr.Tabs():
 
159
  with gr.TabItem("๐Ÿ… Live Rankings"):
160
  leaderboard = init_acc_leaderboard(acc_models_df)
161
+ leaderboard_display = gr.Dataframe(value=acc_models_df, interactive=False, label="๐Ÿ”ฅ Live Scores")
162
+ score_chart = gr.Plot(generate_score_chart(acc_models_df))
163
+ gr.HTML(generate_flip_cards())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
165
  # ๐Ÿ”„ **Auto-Update Leaderboard**
166
  scheduler = BackgroundScheduler()
167
+ scheduler.add_job(lambda: leaderboard_display.update(*update_scores()), "interval", seconds=10)
168
  scheduler.start()
169
 
170
  demo.launch()