Spaces:
Runtime error
Runtime error
Corey Morris
commited on
Commit
·
22725f7
1
Parent(s):
6b85865
added fake data and application dependencies
Browse files- app.py +19 -4
- requirements.txt +2 -0
app.py
CHANGED
|
@@ -1,7 +1,22 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
|
| 5 |
+
# Create a sample dataframe with 10 language models and 57 attributes
|
| 6 |
+
np.random.seed(0)
|
| 7 |
+
data = pd.DataFrame(np.random.rand(10, 57),
|
| 8 |
+
columns=[f'Attribute_{i+1}' for i in range(57)],
|
| 9 |
+
index=[f'Model_{i+1}' for i in range(10)])
|
| 10 |
|
| 11 |
+
# Let's consider the first attribute as the main one for sorting the leaderboard
|
| 12 |
+
data = data.sort_values('Attribute_1', ascending=False)
|
| 13 |
+
|
| 14 |
+
def show_leaderboard():
|
| 15 |
+
# Convert dataframe to html so that it can be displayed properly in Gradio
|
| 16 |
+
return data.to_html()
|
| 17 |
+
|
| 18 |
+
iface = gr.Interface(fn=show_leaderboard, inputs=[], outputs="html")
|
| 19 |
+
|
| 20 |
+
# Run the interface.
|
| 21 |
+
# Note: you don't need to use .launch() in Hugging Face Spaces, this is for local testing.
|
| 22 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas
|
| 2 |
+
numpy
|