Added 'download as CSV'.
Browse filesSigned-off-by: Jonathan Bnayahu <[email protected]>
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_leaderboard import Leaderboard
|
3 |
from apscheduler.schedulers.background import BackgroundScheduler
|
@@ -36,6 +37,10 @@ def init_leaderboard(dataframe):
|
|
36 |
interactive=False,
|
37 |
)
|
38 |
|
|
|
|
|
|
|
|
|
39 |
|
40 |
demo = gr.Blocks(css=custom_css)
|
41 |
with demo:
|
@@ -50,6 +55,20 @@ with demo:
|
|
50 |
with gr.TabItem("π About", elem_id="llm-benchmark-tab-table", id=2):
|
51 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
with gr.Row():
|
54 |
with gr.Accordion("π Citation", open=False):
|
55 |
citation_button = gr.Textbox(
|
|
|
1 |
+
import io
|
2 |
import gradio as gr
|
3 |
from gradio_leaderboard import Leaderboard
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
|
|
37 |
interactive=False,
|
38 |
)
|
39 |
|
40 |
+
def download_csv():
|
41 |
+
with io.StringIO() as buffer:
|
42 |
+
LEADERBOARD_DF.to_csv(buffer, index=False)
|
43 |
+
return buffer.getvalue()
|
44 |
|
45 |
demo = gr.Blocks(css=custom_css)
|
46 |
with demo:
|
|
|
55 |
with gr.TabItem("π About", elem_id="llm-benchmark-tab-table", id=2):
|
56 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
57 |
|
58 |
+
with gr.Row():
|
59 |
+
with gr.Accordion("πΎ Download as CSV", open=False):
|
60 |
+
download_button = gr.Button("Click to Generate CSV File")
|
61 |
+
csv_output = gr.File(label="Generated File")
|
62 |
+
|
63 |
+
def generate_csv_file():
|
64 |
+
csv_content = download_csv()
|
65 |
+
csv_output.visible=True
|
66 |
+
with open("bluebench.csv", "w", encoding="utf-8") as f:
|
67 |
+
f.write(csv_content)
|
68 |
+
return "bluebench.csv"
|
69 |
+
|
70 |
+
download_button.click(fn=generate_csv_file, outputs=csv_output)
|
71 |
+
|
72 |
with gr.Row():
|
73 |
with gr.Accordion("π Citation", open=False):
|
74 |
citation_button = gr.Textbox(
|