mcp-bench / app.py
ztwang's picture
Upload 22 files
4966301 verified
raw
history blame
1.19 kB
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
"""
# Read the HTML content
with open('index.html', 'r', encoding='utf-8') as f:
html_content = f.read()
# Read the CSS content
with open('style.css', 'r', encoding='utf-8') as f:
css_content = f.read()
# Read the JavaScript content
with open('script.js', 'r', encoding='utf-8') as f:
js_content = f.read()
# Combine everything into a single HTML page
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>'
)
# Create the Gradio interface
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()