import gradio as gr | |
import pandas as pd | |
# Creating a sample dataframe | |
df = pd.DataFrame( | |
{ | |
"A": [14, 4, 5, 4, 1], | |
"B": [5, 2, 54, 3, 2], | |
"C": [20, 20, 7, 3, 8], | |
"D": [14, 3, 6, 2, 6], | |
"E": [23, 45, 64, 32, 23], | |
} | |
) | |
# Applying style to highlight the maximum value in each row | |
styler = df.style.highlight_max(color="lightgreen", axis=0) | |
# Displaying the styled dataframe in Gradio | |
with gr.Blocks() as demo: | |
gr.DataFrame(styler) | |
demo.launch(share=True) |