|
|
import gradio as gr |
|
|
import os |
|
|
|
|
|
def create_gradio_app(): |
|
|
""" |
|
|
Simple Gradio app to serve the static HTML leaderboard |
|
|
This is required for Hugging Face Spaces deployment |
|
|
""" |
|
|
|
|
|
|
|
|
with open('index.html', 'r', encoding='utf-8') as f: |
|
|
html_content = f.read() |
|
|
|
|
|
|
|
|
with open('style.css', 'r', encoding='utf-8') as f: |
|
|
css_content = f.read() |
|
|
|
|
|
|
|
|
with open('script.js', 'r', encoding='utf-8') as f: |
|
|
js_content = f.read() |
|
|
|
|
|
|
|
|
combined_html = html_content.replace( |
|
|
'<link rel="stylesheet" href="style.css">', |
|
|
f'<style>{css_content}</style>' |
|
|
).replace( |
|
|
'<script src="script.js"></script>', |
|
|
f'<script>{js_content}</script>' |
|
|
) |
|
|
|
|
|
|
|
|
with gr.Blocks( |
|
|
title="MCP Benchmark Leaderboard", |
|
|
theme=gr.themes.Soft(), |
|
|
) as demo: |
|
|
gr.HTML( |
|
|
combined_html, |
|
|
elem_id="leaderboard-container" |
|
|
) |
|
|
|
|
|
return demo |
|
|
|
|
|
if __name__ == "__main__": |
|
|
demo = create_gradio_app() |
|
|
demo.launch() |