File size: 700 Bytes
1797aaf
 
 
 
 
 
 
 
 
 
 
 
 
 
0930ba7
1797aaf
0930ba7
 
 
 
 
 
 
 
 
 
 
1797aaf
 
 
 
 
 
 
 
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
# my_table_app_gradio.py

import gradio as gr
import pandas as pd

def display_table():
    # Create a sample dataframe
    data = {
        "Model": ["ModelA", "ModelB", "ModelC"],
        "Score": [0.92, 0.85, 0.89],
        "Quantized Score": [0.91, 0.84, 0.88]
    }
    df = pd.DataFrame(data)

	df.index.name = "Rank"
    # Convert the DataFrame to an HTML table string
    html_table = df.to_html(classes="wide_table")


	html_content = f"""
    <style>
        .wide_table {
            width: 100%;
        }
    </style>
    {html_table}
    """

    return html_table

# Create Gradio interface
iface = gr.Interface(fn=display_table, live=True, inputs=[], outputs="html")

iface.launch()