Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,21 +57,29 @@ def create_trend_chart(space_id, daily_ranks_df):
|
|
| 57 |
return None
|
| 58 |
|
| 59 |
def get_duplicate_spaces(top_100_spaces):
|
| 60 |
-
# ID๋ณ
|
| 61 |
-
|
| 62 |
-
#
|
| 63 |
-
|
| 64 |
-
return
|
| 65 |
|
| 66 |
-
def create_duplicates_chart(
|
| 67 |
-
if
|
| 68 |
return None
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
fig = px.bar(
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
| 75 |
height=400
|
| 76 |
)
|
| 77 |
|
|
@@ -80,13 +88,22 @@ def create_duplicates_chart(duplicates):
|
|
| 80 |
margin=dict(t=50, r=20, b=40, l=40),
|
| 81 |
plot_bgcolor='white',
|
| 82 |
paper_bgcolor='white',
|
| 83 |
-
xaxis_tickangle=-45
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
)
|
| 85 |
|
| 86 |
fig.update_traces(
|
| 87 |
marker_color='#4CAF50'
|
| 88 |
)
|
| 89 |
|
|
|
|
|
|
|
|
|
|
| 90 |
return fig
|
| 91 |
|
| 92 |
def update_display(selection):
|
|
|
|
| 57 |
return None
|
| 58 |
|
| 59 |
def get_duplicate_spaces(top_100_spaces):
|
| 60 |
+
# ID๋ณ trending score ํฉ๊ณ ๊ณ์ฐ
|
| 61 |
+
score_sums = top_100_spaces.groupby('id')['trendingScore'].sum().sort_values(ascending=False)
|
| 62 |
+
# ์์ 20๊ฐ๋ง ์ ํ
|
| 63 |
+
top_20_scores = score_sums.head(20)
|
| 64 |
+
return top_20_scores
|
| 65 |
|
| 66 |
+
def create_duplicates_chart(score_sums):
|
| 67 |
+
if score_sums.empty:
|
| 68 |
return None
|
| 69 |
|
| 70 |
+
# ์์ ๋งค๊ธฐ๊ธฐ (1๋ถํฐ 20๊น์ง)
|
| 71 |
+
df = pd.DataFrame({
|
| 72 |
+
'id': score_sums.index,
|
| 73 |
+
'score': score_sums.values,
|
| 74 |
+
'rank': range(1, len(score_sums) + 1)
|
| 75 |
+
})
|
| 76 |
+
|
| 77 |
fig = px.bar(
|
| 78 |
+
df,
|
| 79 |
+
x='id',
|
| 80 |
+
y='rank',
|
| 81 |
+
title="Top 20 Spaces by Total Trending Score",
|
| 82 |
+
labels={'id': 'Space ID', 'rank': 'Rank'},
|
| 83 |
height=400
|
| 84 |
)
|
| 85 |
|
|
|
|
| 88 |
margin=dict(t=50, r=20, b=40, l=40),
|
| 89 |
plot_bgcolor='white',
|
| 90 |
paper_bgcolor='white',
|
| 91 |
+
xaxis_tickangle=-45,
|
| 92 |
+
yaxis=dict(
|
| 93 |
+
range=[20.5, 0.5], # Y์ถ ๋ฐ์
|
| 94 |
+
tickmode='linear',
|
| 95 |
+
tick0=1,
|
| 96 |
+
dtick=1
|
| 97 |
+
)
|
| 98 |
)
|
| 99 |
|
| 100 |
fig.update_traces(
|
| 101 |
marker_color='#4CAF50'
|
| 102 |
)
|
| 103 |
|
| 104 |
+
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='lightgray')
|
| 105 |
+
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='lightgray')
|
| 106 |
+
|
| 107 |
return fig
|
| 108 |
|
| 109 |
def update_display(selection):
|