Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
test
Browse files
app.py
CHANGED
|
@@ -329,11 +329,6 @@ def run_bot():
|
|
| 329 |
threading.Thread(target=run_bot).start()
|
| 330 |
|
| 331 |
|
| 332 |
-
def get_data():
|
| 333 |
-
first_3_columns = global_df.iloc[:, 1:4]
|
| 334 |
-
first_3_columns.to_csv('first_3_columns.csv', index=False)
|
| 335 |
-
return first_3_columns
|
| 336 |
-
|
| 337 |
# csv
|
| 338 |
# read into pandas dataframe1
|
| 339 |
# read levels column and create pandas dataframe2 with first column containing levels from 2-max found in dataframe1
|
|
@@ -341,39 +336,5 @@ def get_data():
|
|
| 341 |
|
| 342 |
demo = gr.Blocks()
|
| 343 |
with demo:
|
| 344 |
-
column_values_unique = sorted(global_df.iloc[:, 3].unique())
|
| 345 |
-
dataframe2 = pd.DataFrame({'Levels': column_values_unique})
|
| 346 |
-
counts = {}
|
| 347 |
-
for value in global_df.iloc[:, 3]:
|
| 348 |
-
counts[value] = counts.get(value, 0) + 1
|
| 349 |
-
dataframe2['Members'] = dataframe2['Levels'].map(counts)
|
| 350 |
-
|
| 351 |
-
print("Dataframe 1:")
|
| 352 |
-
print(dataframe1)
|
| 353 |
-
print("\nDataframe 2:")
|
| 354 |
-
print(dataframe2)
|
| 355 |
-
|
| 356 |
-
TITLE = """<h1 align="center" id="space-title">π€ Hugging Face Level Leaderboard</h1>"""
|
| 357 |
gr.HTML(TITLE)
|
| 358 |
-
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 359 |
-
with gr.TabItem("π
Level leaderboard", elem_id="level-table", id=0):
|
| 360 |
-
#gr.Markdown("# π Experience Leaderboard")
|
| 361 |
-
with gr.Row():
|
| 362 |
-
with gr.Column():
|
| 363 |
-
gr.DataFrame(get_data, every=5, height=500, interactive=False, col_count=(3, "fixed"), column_widths=["100px","100px","100px"])
|
| 364 |
-
|
| 365 |
-
with gr.Column():
|
| 366 |
-
gr.BarPlot(
|
| 367 |
-
value=dataframe2,
|
| 368 |
-
x="Levels",
|
| 369 |
-
y="Members",
|
| 370 |
-
title="Level Distribution",
|
| 371 |
-
height=450,
|
| 372 |
-
width=450,
|
| 373 |
-
interactive=False
|
| 374 |
-
)
|
| 375 |
-
#with gr.TabItem("π Members of the Week", elem_id="week-table", id=1):
|
| 376 |
-
|
| 377 |
-
#with gr.TabItem("π Hub-only leaderboard", elem_id="hub-table", id=2):
|
| 378 |
-
|
| 379 |
demo.queue().launch()
|
|
|
|
| 329 |
threading.Thread(target=run_bot).start()
|
| 330 |
|
| 331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
# csv
|
| 333 |
# read into pandas dataframe1
|
| 334 |
# read levels column and create pandas dataframe2 with first column containing levels from 2-max found in dataframe1
|
|
|
|
| 336 |
|
| 337 |
demo = gr.Blocks()
|
| 338 |
with demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
gr.HTML(TITLE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
demo.queue().launch()
|