|
import gradio as gr
|
|
import pandas as pd
|
|
import plotly.express as px
|
|
|
|
|
|
def plot_csv(df):
|
|
|
|
df.set_index('Model', inplace=True)
|
|
|
|
|
|
df_transposed = df.T
|
|
|
|
|
|
fig = px.line(df_transposed, x=df_transposed.index, y=df_transposed.columns,
|
|
title='Model Evaluation Results',
|
|
labels={'value': 'Evaluation Score', 'index': 'Evaluation Metric'},
|
|
color_discrete_sequence=px.colors.qualitative.Plotly)
|
|
|
|
|
|
fig.update_traces(hovertemplate='%{y}')
|
|
|
|
return fig
|
|
|
|
|
|
|
|
file_path = 'line_counts_QS.csv'
|
|
df = pd.read_csv(file_path)
|
|
|
|
|
|
iface = gr.Interface(
|
|
fn=plot_csv,
|
|
inputs=gr.Dataframe(df),
|
|
outputs=gr.Plot(label="Line Plot"),
|
|
title="CSV to Line Plot",
|
|
description="Visualize the evaluation results as a line plot."
|
|
)
|
|
|
|
iface.launch() |