File size: 1,192 Bytes
4966301 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
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() |