Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ def create_trend_chart(space_id, daily_ranks_df):
|
|
| 31 |
xaxis_title="Date",
|
| 32 |
yaxis_title="Rank",
|
| 33 |
yaxis=dict(
|
| 34 |
-
range=[100, 1],
|
| 35 |
tickmode='linear',
|
| 36 |
tick0=1,
|
| 37 |
dtick=10
|
|
@@ -54,55 +54,111 @@ def create_trend_chart(space_id, daily_ranks_df):
|
|
| 54 |
|
| 55 |
return fig
|
| 56 |
except Exception as e:
|
| 57 |
-
print(f"Error creating chart: {e}")
|
|
|
|
| 58 |
return None
|
| 59 |
|
| 60 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
try:
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
#
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
(daily_ranks_df['date'] == latest_date) &
|
| 69 |
(daily_ranks_df['rank'] <= 100)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
].copy()
|
| 71 |
-
print(f"Number of entries in top 100: {len(latest_top_100)}")
|
| 72 |
|
| 73 |
-
#
|
| 74 |
-
id_counts =
|
|
|
|
| 75 |
multiple_ids = id_counts[id_counts >= 2].index
|
| 76 |
-
print(f"IDs with multiple entries: {len(multiple_ids)}")
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
|
|
|
| 80 |
|
| 81 |
-
#
|
| 82 |
-
|
| 83 |
-
'total_score': multiple_entries.groupby('id')['trendingScore'].sum(),
|
| 84 |
-
'count': multiple_entries.groupby('id')['id'].count()
|
| 85 |
-
}).sort_values('total_score', ascending=True)
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
|
|
|
|
| 91 |
|
|
|
|
| 92 |
except Exception as e:
|
| 93 |
-
print(f"Error in
|
| 94 |
traceback.print_exc()
|
| 95 |
return pd.DataFrame()
|
| 96 |
|
| 97 |
-
def create_score_chart(
|
| 98 |
"""
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
- ์์ 10๊ฐ๋ง ํ์ (total_score ๊ธฐ์ค ๋ด๋ฆผ์ฐจ์).
|
| 102 |
"""
|
| 103 |
try:
|
| 104 |
-
if
|
| 105 |
-
# ์ค๋ณต๋
|
| 106 |
placeholder_df = pd.DataFrame({"id": ["No multiple entries"], "total_score": [0]})
|
| 107 |
fig = px.bar(
|
| 108 |
placeholder_df,
|
|
@@ -121,40 +177,17 @@ def create_score_chart(total_scores):
|
|
| 121 |
)
|
| 122 |
return fig
|
| 123 |
|
| 124 |
-
#
|
| 125 |
-
df =
|
| 126 |
|
| 127 |
-
if df.empty:
|
| 128 |
-
# ์ค๋ณต๋ ID๋ ์กด์ฌํ์ง๋ง ์ค์ฝ์ด๊ฐ 0์ด๊ฑฐ๋ ๋ฑ๋ฑ, ์๋์น ์๊ฒ ๋น์์ ๊ฒฝ์ฐ ๋๋น
|
| 129 |
-
placeholder_df = pd.DataFrame({"id": ["No multiple entries"], "total_score": [0]})
|
| 130 |
-
fig = px.bar(
|
| 131 |
-
placeholder_df,
|
| 132 |
-
x="total_score",
|
| 133 |
-
y="id",
|
| 134 |
-
orientation='h'
|
| 135 |
-
)
|
| 136 |
-
fig.update_layout(
|
| 137 |
-
title="No multiple entries found in Top 100",
|
| 138 |
-
xaxis_title="Total Trending Score",
|
| 139 |
-
yaxis_title="Space ID",
|
| 140 |
-
plot_bgcolor='white',
|
| 141 |
-
paper_bgcolor='white',
|
| 142 |
-
showlegend=False,
|
| 143 |
-
margin=dict(l=200, r=20, t=40, b=40),
|
| 144 |
-
)
|
| 145 |
-
return fig
|
| 146 |
-
|
| 147 |
fig = px.bar(
|
| 148 |
df,
|
| 149 |
y='id',
|
| 150 |
x='total_score',
|
| 151 |
orientation='h',
|
| 152 |
-
title=f"Top
|
| 153 |
height=400,
|
| 154 |
-
text=[
|
| 155 |
-
f"Score: {score:.1f}\nEntries: {count}"
|
| 156 |
-
for score, count in zip(df['total_score'], df['count'])
|
| 157 |
-
]
|
| 158 |
)
|
| 159 |
|
| 160 |
fig.update_layout(
|
|
@@ -182,6 +215,10 @@ def create_score_chart(total_scores):
|
|
| 182 |
return None
|
| 183 |
|
| 184 |
def update_display(selection):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
global daily_ranks_df
|
| 186 |
|
| 187 |
if not selection:
|
|
@@ -219,58 +256,25 @@ def update_display(selection):
|
|
| 219 |
print(f"Error in update_display: {e}")
|
| 220 |
return None, gr.HTML(value=f"<div style='color: red;'>Error processing data: {str(e)}</div>")
|
| 221 |
|
| 222 |
-
|
| 223 |
-
try:
|
| 224 |
-
url = "https://huggingface.co/datasets/cfahlgren1/hub-stats/resolve/main/spaces.parquet"
|
| 225 |
-
response = requests.get(url)
|
| 226 |
-
df = pd.read_parquet(BytesIO(response.content))
|
| 227 |
-
|
| 228 |
-
thirty_days_ago = datetime.now() - timedelta(days=30)
|
| 229 |
-
df['createdAt'] = pd.to_datetime(df['createdAt'])
|
| 230 |
-
df = df[df['createdAt'] >= thirty_days_ago].copy()
|
| 231 |
-
|
| 232 |
-
dates = pd.date_range(start=thirty_days_ago, end=datetime.now(), freq='D')
|
| 233 |
-
daily_ranks = []
|
| 234 |
-
|
| 235 |
-
for date in dates:
|
| 236 |
-
date_data = df[df['createdAt'].dt.date <= date.date()].copy()
|
| 237 |
-
date_data = date_data.sort_values(['trendingScore', 'id'], ascending=[False, True])
|
| 238 |
-
date_data['rank'] = range(1, len(date_data) + 1)
|
| 239 |
-
date_data['date'] = date.date()
|
| 240 |
-
daily_ranks.append(
|
| 241 |
-
date_data[['id', 'date', 'rank', 'trendingScore', 'createdAt']]
|
| 242 |
-
)
|
| 243 |
-
|
| 244 |
-
daily_ranks_df = pd.concat(daily_ranks, ignore_index=True)
|
| 245 |
-
|
| 246 |
-
latest_date = daily_ranks_df['date'].max()
|
| 247 |
-
top_100_spaces = daily_ranks_df[
|
| 248 |
-
(daily_ranks_df['date'] == latest_date) &
|
| 249 |
-
(daily_ranks_df['rank'] <= 100)
|
| 250 |
-
].sort_values('rank').copy()
|
| 251 |
-
|
| 252 |
-
return daily_ranks_df, top_100_spaces
|
| 253 |
-
except Exception as e:
|
| 254 |
-
print(f"Error loading data: {e}")
|
| 255 |
-
traceback.print_exc()
|
| 256 |
-
return pd.DataFrame(), pd.DataFrame()
|
| 257 |
|
| 258 |
# ๋ฐ์ดํฐ ๋ก๋
|
| 259 |
print("Loading initial data...")
|
| 260 |
daily_ranks_df, top_100_spaces = load_and_process_data()
|
| 261 |
print("Data loaded successfully!")
|
| 262 |
|
| 263 |
-
#
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
score_chart = create_score_chart(total_scores) # <- ์ฌ๊ธฐ์ ์ฐจํธ ์์ฑ
|
| 267 |
|
| 268 |
# Gradio ์ธํฐํ์ด์ค ์์ฑ
|
| 269 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 270 |
gr.Markdown("""
|
| 271 |
# HF Space Ranking Tracker
|
| 272 |
|
| 273 |
-
Track, analyze, and discover trending AI applications in the Hugging Face ecosystem.
|
|
|
|
|
|
|
| 274 |
""")
|
| 275 |
|
| 276 |
with gr.Tabs():
|
|
@@ -284,26 +288,27 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 284 |
)
|
| 285 |
# ์ค๋ฅธ์ชฝ(Score Chart)
|
| 286 |
with gr.Column(scale=3):
|
| 287 |
-
#
|
| 288 |
score_plot = gr.Plot(
|
| 289 |
value=score_chart,
|
| 290 |
-
label="Multiple
|
| 291 |
container=True
|
| 292 |
)
|
| 293 |
|
|
|
|
| 294 |
with gr.Row():
|
| 295 |
info_box = gr.HTML(
|
| 296 |
value="<div style='text-align: center; padding: 20px; color: #666;'>Select a space to view details</div>"
|
| 297 |
)
|
| 298 |
|
| 299 |
-
# ๋ผ๋์ค
|
| 300 |
space_selection = gr.Radio(
|
| 301 |
choices=[row['id'] for _, row in top_100_spaces.iterrows()],
|
| 302 |
value=None,
|
| 303 |
visible=False
|
| 304 |
)
|
| 305 |
|
| 306 |
-
# HTML
|
| 307 |
html_content = """
|
| 308 |
<div style='display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;'>
|
| 309 |
""" + "".join([
|
|
@@ -391,12 +396,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 391 |
- Make data-driven decisions about your AI projects
|
| 392 |
- Stay ahead of the curve in AI application development
|
| 393 |
|
| 394 |
-
Our dashboard provides a comprehensive view of the Hugging Face Spaces ecosystem,
|
|
|
|
|
|
|
| 395 |
|
| 396 |
-
|
|
|
|
| 397 |
""")
|
| 398 |
|
| 399 |
-
# ๋ผ๋์ค ๋ฒํผ
|
| 400 |
space_selection.change(
|
| 401 |
fn=update_display,
|
| 402 |
inputs=[space_selection],
|
|
@@ -406,4 +414,3 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 406 |
|
| 407 |
if __name__ == "__main__":
|
| 408 |
demo.launch(share=True)
|
| 409 |
-
|
|
|
|
| 31 |
xaxis_title="Date",
|
| 32 |
yaxis_title="Rank",
|
| 33 |
yaxis=dict(
|
| 34 |
+
range=[100, 1], # ๋ญํน์ด 1์ด ์ต๊ณ ์ด๋ฏ๋ก y์ถ์ ๋ค์ง์ด์ ํ์
|
| 35 |
tickmode='linear',
|
| 36 |
tick0=1,
|
| 37 |
dtick=10
|
|
|
|
| 54 |
|
| 55 |
return fig
|
| 56 |
except Exception as e:
|
| 57 |
+
print(f"Error creating trend chart: {e}")
|
| 58 |
+
traceback.print_exc()
|
| 59 |
return None
|
| 60 |
|
| 61 |
+
def load_and_process_data():
|
| 62 |
+
"""
|
| 63 |
+
1) spaces.parquet๋ฅผ ๋ค์ด๋ก๋ํ์ฌ DataFrame์ผ๋ก ๋ณํ
|
| 64 |
+
2) ์ต๊ทผ 30์ผ์น ๋ฐ์ดํฐ๋ง ํํฐ๋ง
|
| 65 |
+
3) ๋งค ์ผ์๋ณ๋ก trendingScore ๋ด๋ฆผ์ฐจ์์ผ๋ก rank๋ฅผ ๋งค๊ธด ๋ค, ๋์
|
| 66 |
+
"""
|
| 67 |
try:
|
| 68 |
+
url = "https://huggingface.co/datasets/cfahlgren1/hub-stats/resolve/main/spaces.parquet"
|
| 69 |
+
response = requests.get(url)
|
| 70 |
+
df = pd.read_parquet(BytesIO(response.content))
|
| 71 |
+
|
| 72 |
+
# ์ต๊ทผ 30์ผ ๊ธฐ์ค์ผ๋ก ํํฐ๋ง
|
| 73 |
+
thirty_days_ago = datetime.now() - timedelta(days=30)
|
| 74 |
+
df['createdAt'] = pd.to_datetime(df['createdAt'])
|
| 75 |
+
df = df[df['createdAt'] >= thirty_days_ago].copy()
|
| 76 |
+
|
| 77 |
+
# 30์ผ ๋์์ ๋ชจ๋ ๋ ์ง์ ๋ํด
|
| 78 |
+
dates = pd.date_range(start=thirty_days_ago, end=datetime.now(), freq='D')
|
| 79 |
+
daily_ranks = []
|
| 80 |
+
|
| 81 |
+
for date in dates:
|
| 82 |
+
# date ๋ ์ง๊น์ง ์์ฑ๋ ์คํ์ด์ค๋ง ํํฐ๋ง
|
| 83 |
+
date_data = df[df['createdAt'].dt.date <= date.date()].copy()
|
| 84 |
+
# trendingScore ๋์ ์, id ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌ ํ rank ๋ถ์ฌ
|
| 85 |
+
date_data = date_data.sort_values(['trendingScore', 'id'], ascending=[False, True])
|
| 86 |
+
date_data['rank'] = range(1, len(date_data) + 1)
|
| 87 |
+
date_data['date'] = date.date()
|
| 88 |
+
|
| 89 |
+
daily_ranks.append(
|
| 90 |
+
date_data[['id', 'date', 'rank', 'trendingScore', 'createdAt']]
|
| 91 |
+
)
|
| 92 |
|
| 93 |
+
# ํ๋ฃจํ๋ฃจ ์์ธ rank ๊ธฐ๋ก์ ๋ชจ๋ ํฉ์นจ
|
| 94 |
+
daily_ranks_df = pd.concat(daily_ranks, ignore_index=True)
|
| 95 |
+
|
| 96 |
+
# ์ต์ ๋ ์ง์ Top100๋ง ๋ณ๋๋ก ์ถ์ถ
|
| 97 |
+
latest_date = daily_ranks_df['date'].max()
|
| 98 |
+
top_100_spaces = daily_ranks_df[
|
| 99 |
(daily_ranks_df['date'] == latest_date) &
|
| 100 |
(daily_ranks_df['rank'] <= 100)
|
| 101 |
+
].sort_values('rank').copy()
|
| 102 |
+
|
| 103 |
+
return daily_ranks_df, top_100_spaces
|
| 104 |
+
except Exception as e:
|
| 105 |
+
print(f"Error loading data: {e}")
|
| 106 |
+
traceback.print_exc()
|
| 107 |
+
return pd.DataFrame(), pd.DataFrame()
|
| 108 |
+
|
| 109 |
+
def get_top20_multiple_ids(daily_ranks_df):
|
| 110 |
+
"""
|
| 111 |
+
'์ต์ ๋ ์ง์ Top100'์์, ๋์ผํ id๊ฐ 2๊ฐ ์ด์ ๋ฑ์ฅํ๋ ๊ฒฝ์ฐ
|
| 112 |
+
ํด๋น ์ค์ฝ์ด๋ฅผ ํฉ์ฐํ์ฌ, ํฉ๊ณ๊ฐ ๋์ ์์ผ๋ก top 20๊น์ง๋ง ๋ฆฌํดํ๋ ํจ์
|
| 113 |
+
"""
|
| 114 |
+
if daily_ranks_df.empty:
|
| 115 |
+
return pd.DataFrame()
|
| 116 |
+
|
| 117 |
+
try:
|
| 118 |
+
# ์ต์ ๋ ์ง ํ์
|
| 119 |
+
latest_date = daily_ranks_df['date'].max()
|
| 120 |
+
|
| 121 |
+
# ์ต์ ๋ ์ง์ Top100๋ง ํํฐ๋ง
|
| 122 |
+
latest_top100 = daily_ranks_df[
|
| 123 |
+
(daily_ranks_df['date'] == latest_date) & (daily_ranks_df['rank'] <= 100)
|
| 124 |
].copy()
|
|
|
|
| 125 |
|
| 126 |
+
# id๋ณ ๋ฑ์ฅ ํ์ (Top100 ๋ด)
|
| 127 |
+
id_counts = latest_top100['id'].value_counts()
|
| 128 |
+
# 2๊ฐ ์ด์ ๋ฑ์ฅํ๋ id๋ง ์ถ์ถ
|
| 129 |
multiple_ids = id_counts[id_counts >= 2].index
|
|
|
|
| 130 |
|
| 131 |
+
if len(multiple_ids) == 0:
|
| 132 |
+
# ์ค๋ณต id๊ฐ ์์ ์๋ ๊ฒฝ์ฐ
|
| 133 |
+
return pd.DataFrame()
|
| 134 |
|
| 135 |
+
# ์ค๋ณต๋ id์ ํด๋นํ๋ ํ๋ง ๋ชจ์ผ๊ธฐ
|
| 136 |
+
multiple_entries = latest_top100[latest_top100['id'].isin(multiple_ids)].copy()
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
+
# id๋ณ๋ก score ํฉ์ฐ
|
| 139 |
+
df_sum = (multiple_entries
|
| 140 |
+
.groupby('id')['trendingScore']
|
| 141 |
+
.sum()
|
| 142 |
+
.reset_index()
|
| 143 |
+
.rename(columns={'trendingScore': 'total_score'}))
|
| 144 |
|
| 145 |
+
# ํฉ์ฐ๋ total_score ์์ผ๋ก ๋ด๋ฆผ์ฐจ์ ์ ๋ ฌ ํ ์์ 20
|
| 146 |
+
df_sum = df_sum.sort_values(by='total_score', ascending=False).head(20)
|
| 147 |
|
| 148 |
+
return df_sum
|
| 149 |
except Exception as e:
|
| 150 |
+
print(f"Error in get_top20_multiple_ids: {e}")
|
| 151 |
traceback.print_exc()
|
| 152 |
return pd.DataFrame()
|
| 153 |
|
| 154 |
+
def create_score_chart(multiple_ids_df):
|
| 155 |
"""
|
| 156 |
+
์์์ ๋ง๋ df_sum (id + total_score) ๋ฅผ ๊ฐ์ง๊ณ ,
|
| 157 |
+
id๋ณ total_score ๋ง๋ ์ฐจํธ๋ฅผ ์์ฑ. ์์ 20๊ฐ๋ง ํ์.
|
|
|
|
| 158 |
"""
|
| 159 |
try:
|
| 160 |
+
if multiple_ids_df.empty:
|
| 161 |
+
# ์ค๋ณต๋ id ์์ฒด๊ฐ ํ๋๋ ์๋ ๊ฒฝ์ฐ(๋๋ ์ง๊ณ๊ฒฐ๊ณผ ์์)
|
| 162 |
placeholder_df = pd.DataFrame({"id": ["No multiple entries"], "total_score": [0]})
|
| 163 |
fig = px.bar(
|
| 164 |
placeholder_df,
|
|
|
|
| 177 |
)
|
| 178 |
return fig
|
| 179 |
|
| 180 |
+
# ์ฌ๊ธฐ์ multiple_ids_df์๋ ์ด๋ฏธ ์์ 20๊ฐ๋ง ์๋ ์ํ
|
| 181 |
+
df = multiple_ids_df.copy()
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
fig = px.bar(
|
| 184 |
df,
|
| 185 |
y='id',
|
| 186 |
x='total_score',
|
| 187 |
orientation='h',
|
| 188 |
+
title=f"Top 20 IDs with Multiple Entries in Top 100",
|
| 189 |
height=400,
|
| 190 |
+
text=[f"Score: {score:.2f}" for score in df['total_score']]
|
|
|
|
|
|
|
|
|
|
| 191 |
)
|
| 192 |
|
| 193 |
fig.update_layout(
|
|
|
|
| 215 |
return None
|
| 216 |
|
| 217 |
def update_display(selection):
|
| 218 |
+
"""
|
| 219 |
+
์ฌ์ฉ์๊ฐ ์ผ์ชฝ/HTML ์นด๋์์ ํน์ id๋ฅผ ์ ํํ์ ๋,
|
| 220 |
+
๊ทธ id์ ๋ํ ์ผ๊ฐ Trend Chart + ์์ธ ์ ๋ณด๋ฅผ ๋ฐํ
|
| 221 |
+
"""
|
| 222 |
global daily_ranks_df
|
| 223 |
|
| 224 |
if not selection:
|
|
|
|
| 256 |
print(f"Error in update_display: {e}")
|
| 257 |
return None, gr.HTML(value=f"<div style='color: red;'>Error processing data: {str(e)}</div>")
|
| 258 |
|
| 259 |
+
########## ๋ฉ์ธ ์คํ ##########
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
# ๋ฐ์ดํฐ ๋ก๋
|
| 262 |
print("Loading initial data...")
|
| 263 |
daily_ranks_df, top_100_spaces = load_and_process_data()
|
| 264 |
print("Data loaded successfully!")
|
| 265 |
|
| 266 |
+
# '์ต์ ๋ ์ง์ Top100' ์ค๋ณต ID ์ง๊ณ -> ์์ 20
|
| 267 |
+
multiple_ids_df = get_top20_multiple_ids(daily_ranks_df)
|
| 268 |
+
score_chart = create_score_chart(multiple_ids_df)
|
|
|
|
| 269 |
|
| 270 |
# Gradio ์ธํฐํ์ด์ค ์์ฑ
|
| 271 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 272 |
gr.Markdown("""
|
| 273 |
# HF Space Ranking Tracker
|
| 274 |
|
| 275 |
+
Track, analyze, and discover trending AI applications in the Hugging Face ecosystem.
|
| 276 |
+
Our service continuously monitors and ranks all Spaces over a 30-day period,
|
| 277 |
+
providing detailed analytics and daily ranking changes for the top 100 performers.
|
| 278 |
""")
|
| 279 |
|
| 280 |
with gr.Tabs():
|
|
|
|
| 288 |
)
|
| 289 |
# ์ค๋ฅธ์ชฝ(Score Chart)
|
| 290 |
with gr.Column(scale=3):
|
| 291 |
+
# multiple_ids_df ๊ธฐ๋ฐ ์ฐจํธ
|
| 292 |
score_plot = gr.Plot(
|
| 293 |
value=score_chart,
|
| 294 |
+
label="Multiple-Entry IDs (Top 20)",
|
| 295 |
container=True
|
| 296 |
)
|
| 297 |
|
| 298 |
+
# Space ์์ธ ์ ๋ณด
|
| 299 |
with gr.Row():
|
| 300 |
info_box = gr.HTML(
|
| 301 |
value="<div style='text-align: center; padding: 20px; color: #666;'>Select a space to view details</div>"
|
| 302 |
)
|
| 303 |
|
| 304 |
+
# ๋ผ๋์ค ๋ฒํผ(๊ฐ๋ ค๋๊ณ HTML ๋ฒํผ -> JS -> ๋ผ๋์ค change ์ด๋ฒคํธ ํธ๋ฆฌ๊ฑฐ)
|
| 305 |
space_selection = gr.Radio(
|
| 306 |
choices=[row['id'] for _, row in top_100_spaces.iterrows()],
|
| 307 |
value=None,
|
| 308 |
visible=False
|
| 309 |
)
|
| 310 |
|
| 311 |
+
# Top100 ๋ฆฌ์คํธ๋ฅผ HTML ์นด๋๋ก ํ์ (JS ๋ก ํด๋ฆญ ์ด๋ฒคํธ -> ๋ผ๋์ค ์ ํ)
|
| 312 |
html_content = """
|
| 313 |
<div style='display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;'>
|
| 314 |
""" + "".join([
|
|
|
|
| 396 |
- Make data-driven decisions about your AI projects
|
| 397 |
- Stay ahead of the curve in AI application development
|
| 398 |
|
| 399 |
+
Our dashboard provides a comprehensive view of the Hugging Face Spaces ecosystem,
|
| 400 |
+
helping developers, researchers, and enthusiasts track and understand
|
| 401 |
+
the dynamics of popular AI applications.
|
| 402 |
|
| 403 |
+
Whether you're monitoring your own Space's performance or discovering new trending applications,
|
| 404 |
+
HF Space Ranking Tracker offers the insights you need.
|
| 405 |
""")
|
| 406 |
|
| 407 |
+
# ๋ผ๋์ค ๋ฒํผ change ์ด๋ฒคํธ -> update_display ํจ์
|
| 408 |
space_selection.change(
|
| 409 |
fn=update_display,
|
| 410 |
inputs=[space_selection],
|
|
|
|
| 414 |
|
| 415 |
if __name__ == "__main__":
|
| 416 |
demo.launch(share=True)
|
|
|