protobench / app.py
vtrv.vls
Tabs test
1639c46
raw
history blame
2.69 kB
import gradio
import argparse
import os
from utils import generate
from constants import css, js_code, js_light
MERA_table = None
def gen(content):
res = generate(content,'auth_token.json')
return res
def tab_arena():
arena = gradio.Interface(fn=gen, inputs="text", outputs="text")
arena.launch()
with open("_test.md", "r") as f:
TEST_MD = f.read()
def build_demo():
# global original_dfs, available_models, gpt4t_dfs, haiku_dfs, llama_dfs
with gradio.Blocks(theme=gradio.themes.Soft(), css=css, js=js_light) as demo:
# gradio.HTML(BANNER, elem_id="banner")
# gradio.Markdown(HEADER_MD.replace("{model_num}", str(len(original_dfs["-1"]))), elem_classes="markdown-text")
with gradio.Tabs(elem_classes="tab-buttons") as tabs:
with gradio.TabItem("🐼 MERA leaderboard", elem_id="od-benchmark-tab-table", id=0):
gradio.Markdown(TEST_MD, elem_classes="markdown-text-details")
# _tab_leaderboard()
with gradio.TabItem("πŸ†š SBS by categories and criteria", elem_id="od-benchmark-tab-table", id=1):
gradio.Markdown(TEST_MD, elem_classes="markdown-text-details")
with gradio.TabItem("πŸ₯Š Model arena", elem_id="od-benchmark-tab-table", id=2):
tab_arena()
# _tab_explore()
with gradio.TabItem("πŸ’ͺ About MERA", elem_id="od-benchmark-tab-table", id=3):
gradio.Markdown(TEST_MD, elem_classes="markdown-text")
# gr.Markdown(f"Last updated on **{LAST_UPDATED}** | [Link to V1-legacy](https://huggingface.co/spaces/allenai/WildBench-V1-legacy)", elem_classes="markdown-text-small")
# with gr.Row():
# with gr.Accordion("πŸ“™ Citation", open=False, elem_classes="accordion-label"):
# gr.Textbox(
# value=CITATION_TEXT,
# lines=7,
# label="Copy the BibTeX snippet to cite this source",
# elem_id="citation-button",
# show_copy_button=True)
# ).style(show_copy_button=True)
return demo
if __name__ == "__main__":
parser = argparse.ArgumentParser()
# parser.add_argument("--share", action="store_true")
# parser.add_argument("--bench_table", help="Path to MERA table", default="data_dir/MERA_jun2024.jsonl")
args = parser.parse_args()
# data_load(args.result_file)
# TYPES = ["number", "markdown", "number"]
demo = build_demo()
demo.launch(share=args.share, height=3000, width="110%")
# demo = gradio.Interface(fn=gen, inputs="text", outputs="text")
# demo.launch()