File size: 1,861 Bytes
d786867
0eac02e
 
d786867
55c8a69
 
46ba2c6
0eac02e
79e7993
0eac02e
 
46ba2c6
e83d737
9aa1b3d
e83d737
 
9aa1b3d
e83d737
 
 
0eac02e
9aa1b3d
0eac02e
dc41c89
 
e83d737
79e7993
9aa1b3d
79e7993
 
 
e83d737
9aa1b3d
e83d737
 
79e7993
 
 
 
 
 
 
 
 
 
e83d737
9aa1b3d
29b7ec1
0eac02e
dc41c89
0eac02e
e83d737
 
9aa1b3d
 
e83d737
d786867
46ba2c6
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import gradio as gr
import matplotlib.pyplot as plt
import matplotlib

from bar_plot import create_matplotlib_bar_plot


# Configure matplotlib for better performance
matplotlib.use("Agg")
plt.ioff()


def load_css():
    """Load CSS styling."""
    try:
        with open("styles.css", "r") as f:
            return f.read()
    except FileNotFoundError:
        return "body { background: #000; color: #fff; }"


def refresh_plot():
    """Generate new matplotlib charts and update description."""
    sidebar_text = "**Transformer CI Dashboard**<br>-<br>**AMD runs on MI325**<br>**NVIDIA runs on A10**<br><br>*This dashboard only tracks important models*<br>*(Data refreshed)*"
    return create_matplotlib_bar_plot(), sidebar_text


# Create Gradio interface
with gr.Blocks(
    title="Random Data Dashboard", css=load_css(), fill_height=True, fill_width=True
) as demo:
    with gr.Row():
        # Sidebar
        with gr.Column(scale=1, elem_classes=["sidebar"]):
            gr.Markdown("# 🤖 TCID", elem_classes=["sidebar-title"])
            description = gr.Markdown(
                "**Transformer CI Dashboard**<br>-<br>**AMD runs on MI325**<br>**NVIDIA runs on A10**<br><br>*This dashboard only tracks important models*",
                elem_classes=["sidebar-description"],
            )
            summary_btn = gr.Button(
                "summary\n📊",
                variant="primary",
                size="lg",
                elem_classes=["summary-button"],
            )

        # Main plot area
        with gr.Column(elem_classes=["main-content"]):
            plot = gr.HTML(
                create_matplotlib_bar_plot(),
                elem_classes=["plot-container"],
            )

    # Button click handler
    summary_btn.click(fn=refresh_plot, outputs=[plot, description])

if __name__ == "__main__":
    demo.launch()