MMLU-by-task / app.py
Corey Morris
downloading json file from remote and then loading it
3a8762c
raw
history blame
817 Bytes
import gradio as gr
import pandas as pd
import numpy as np
import json
import requests
# load from remote json file
FILE_URL = "https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-30B/llama-30B_mmlu_5-shot.json"
response = requests.get(FILE_URL)
data = response.json()
# Create a DataFrame from the results dictionary
data = pd.DataFrame(data['results']).T
# Sort the DataFrame by 'acc' column
data = data.sort_values('acc', 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()