Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Style the first few rows of cells (gold silver bronze, first 2nd 3rd etc) (#10)
Browse files- Style the first few rows of cells (gold silver bronze, first 2nd 3rd etc) (e2bdb623e553bdc83efd9f64a99c79f4c846da8e)
Co-authored-by: Vlad Bogolin <vladbogo@users.noreply.huggingface.co>
app.py
CHANGED
@@ -685,9 +685,19 @@ def run_bot():
|
|
685 |
threading.Thread(target=run_bot).start()
|
686 |
|
687 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
688 |
def get_data():
|
689 |
try:
|
690 |
-
return
|
691 |
except Exception as e:
|
692 |
print(f"get_data Error: {e}")
|
693 |
|
@@ -745,4 +755,4 @@ with demo:
|
|
745 |
#with gr.TabItem("π Hub-only leaderboard", elem_id="hub-table", id=2):
|
746 |
except Exception as e:
|
747 |
print(f"gradio demo Error: {e}")
|
748 |
-
demo.queue().launch()
|
|
|
685 |
threading.Thread(target=run_bot).start()
|
686 |
|
687 |
|
688 |
+
def highlight_rows(dataframe):
|
689 |
+
styled = dataframe.style
|
690 |
+
|
691 |
+
styled = styled.map(lambda x: 'background-color: rgba(255, 232, 170, 0.5)', subset=pd.IndexSlice[:0, :])
|
692 |
+
styled = styled.map(lambda x: 'background-color: rgba(217, 217, 217, 0.5)', subset=pd.IndexSlice[1:1, :])
|
693 |
+
styled = styled.map(lambda x: 'background-color: rgba(232, 167, 106, 0.5)', subset=pd.IndexSlice[2:2, :])
|
694 |
+
|
695 |
+
return styled
|
696 |
+
|
697 |
+
|
698 |
def get_data():
|
699 |
try:
|
700 |
+
return highlight_rows(community_global_df)
|
701 |
except Exception as e:
|
702 |
print(f"get_data Error: {e}")
|
703 |
|
|
|
755 |
#with gr.TabItem("π Hub-only leaderboard", elem_id="hub-table", id=2):
|
756 |
except Exception as e:
|
757 |
print(f"gradio demo Error: {e}")
|
758 |
+
demo.queue().launch()
|