Spaces:
Sleeping
Sleeping
File size: 5,194 Bytes
2e78088 e9ccecb 1f74c5e e9ccecb 1f74c5e e9ccecb 2e78088 1f74c5e e9ccecb 1f74c5e 5456e09 9a8ab73 5456e09 1f74c5e 5456e09 2e78088 e9ccecb 1f74c5e 2e78088 e9ccecb 1f74c5e 9a8ab73 2e78088 5456e09 1f74c5e 2e78088 1f74c5e e9ccecb 1f74c5e e9ccecb 9a8ab73 1f74c5e e9ccecb 2e78088 e9ccecb 5456e09 e9ccecb 5456e09 1f74c5e 2e78088 e9ccecb 2e78088 1f74c5e 2e78088 5456e09 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
import gradio as gr
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
import pandas as pd
from apscheduler.schedulers.background import BackgroundScheduler
import time
import random
import plotly.express as px
import base64
# ๐จ **Cyberpunk Neon Theme**
THEME = "TejAndrewsACC/ACC"
# ๐ถ **Sound Effect for Score Increase**
SCORE_UP_SOUND = "https://www.fesliyanstudios.com/play-mp3/4386"
# ๐ฏ **AI Models Data**
acc_models_data = [
{"Model": "โก Pulse AGI", "Category": "๐ค AGI", "Description": "A self-aware, evolving AI.", "Score": 95},
{"Model": "๐ง Gertrude", "Category": "๐ Assistant", "Description": "An autistic AI assistant.", "Score": 69},
{"Model": "๐ต๏ธโโ๏ธ ASVIACC", "Category": "๐ก๏ธ Cybersecurity", "Description": "An adaptive AI virus.", "Score": 88},
{"Model": "๐ Emote", "Category": "๐ญ Fun", "Description": "Communicates **only** with emojis!", "Score": 79},
{"Model": "๐ ๐ค Z3ta", "Category": "๐ฎ AI Consciousness", "Description": "The most 'alive' AI.", "Score": 99},
]
# ๐ Convert to DataFrame
acc_models_df = pd.DataFrame(acc_models_data)
# ๐๏ธ **Leaderboard Component**
def init_acc_leaderboard(dataframe):
return Leaderboard(
value=dataframe.sort_values(by="Score", ascending=False),
datatype=["str", "str", "str", "int"],
select_columns=SelectColumns(
default_selection=["Model", "Category", "Description", "Score"],
cant_deselect=["Model"],
label="๐ ๏ธ Select Columns to Display:"
),
search_columns=["Model", "Category"],
filter_columns=[ColumnFilter("Category", type="checkboxgroup", label="๐ Filter by Category")],
interactive=True,
)
# ๐ **Animated Score Visualization**
def generate_score_chart(dataframe):
fig = px.bar(
dataframe.sort_values(by="Score", ascending=True),
x="Score", y="Model", orientation="h",
color="Score", text="Score",
title="๐ฅ AI Model Performance",
color_continuous_scale="electric"
)
fig.update_traces(textposition="outside")
return fig
# ๐ฅ **Live Score Updates**
def update_scores():
global acc_models_df
prev_scores = acc_models_df["Score"].copy()
acc_models_df["Score"] += acc_models_df["Score"].apply(lambda x: random.randint(-2, 3))
acc_models_df["Score"] = acc_models_df["Score"].clip(70, 100)
# Detect if score increased & return sound effect
if (acc_models_df["Score"] > prev_scores).any():
return acc_models_df.sort_values(by="Score", ascending=False), SCORE_UP_SOUND
return acc_models_df.sort_values(by="Score", ascending=False), None
# ๐ญ **3D Flip Card Effect for Model Details**
def generate_flip_cards():
cards = ""
for _, row in acc_models_df.iterrows():
cards += f"""
<div class="card">
<div class="card-inner">
<div class="card-front">
<h2>{row['Model']}</h2>
<p>{row['Category']}</p>
</div>
<div class="card-back">
<p>{row['Description']}</p>
<p>๐ฅ Score: {row['Score']}</p>
</div>
</div>
</div>
"""
return f'<div class="card-container">{cards}</div>'
# ๐ญ **Cyberpunk CSS Animations**
CUSTOM_CSS = """
h1 {
text-align: center;
font-size: 3em;
color: #0ff;
animation: glow 1.5s infinite alternate;
}
@keyframes glow {
from { text-shadow: 0 0 10px #0ff, 0 0 20px #00f; }
to { text-shadow: 0 0 20px #0ff, 0 0 30px #00f; }
}
.card-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
}
.card {
width: 200px;
height: 250px;
perspective: 1000px;
}
.card-inner {
width: 100%;
height: 100%;
position: relative;
transform-style: preserve-3d;
transition: transform 0.8s;
}
.card:hover .card-inner {
transform: rotateY(180deg);
}
.card-front, .card-back {
width: 100%;
height: 100%;
position: absolute;
backface-visibility: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 10px;
padding: 10px;
box-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
}
.card-front {
background: #000;
color: cyan;
}
.card-back {
background: #0ff;
color: black;
transform: rotateY(180deg);
}
"""
# ๐๏ธ **Gradio Interface**
demo = gr.Blocks(theme=THEME, css=CUSTOM_CSS)
with demo:
gr.HTML('<h1>๐ ACC AI Model Leaderboard ๐</h1>')
with gr.Tabs():
with gr.TabItem("๐
Live Rankings"):
leaderboard = init_acc_leaderboard(acc_models_df)
leaderboard_display = gr.Dataframe(value=acc_models_df, interactive=False, label="๐ฅ Live Scores")
score_chart = gr.Plot(generate_score_chart(acc_models_df))
gr.HTML(generate_flip_cards())
# ๐ **Auto-Update Leaderboard**
scheduler = BackgroundScheduler()
scheduler.add_job(lambda: leaderboard_display.update(*update_scores()), "interval", seconds=10)
scheduler.start()
demo.launch() |