Spaces:
Runtime error
Runtime error
import gradio as gr | |
import pandas as pd | |
import numpy as np | |
# Create a sample dataframe with 10 language models and 57 attributes | |
np.random.seed(0) | |
data = pd.DataFrame(np.random.rand(10, 57), | |
columns=[f'Attribute_{i+1}' for i in range(57)], | |
index=[f'Model_{i+1}' for i in range(10)]) | |
# Let's consider the first attribute as the main one for sorting the leaderboard | |
data = data.sort_values('Attribute_1', ascending=False) | |
def show_leaderboard(): | |
# Convert dataframe to html so that it can be displayed properly in Gradio | |
return data.to_html() | |
iface = gr.Interface(fn=show_leaderboard, inputs=[], outputs="html") | |
# Run the interface. | |
# Note: you don't need to use .launch() in Hugging Face Spaces, this is for local testing. | |
iface.launch() | |