Spaces:
Sleeping
Sleeping
| import plotly.graph_objects as go | |
| import gradio as gr | |
| import os | |
| import json | |
| import plotly.express as px | |
| from collections import defaultdict | |
| def create_plots(data_name, title): | |
| with open(data_name, "r") as f: | |
| data = json.load(f) | |
| # График FLOPs Inference vs F1-score | |
| fig_f1_inf = px.scatter( | |
| data, x="FLOPs Inference", y="F1-score", text="Adapter", | |
| title=f"FLOPs Inference vs F1-score{title}", labels={"FLOPs Inference": "FLOPs (Inference)", "F1-score": "F1-score"} | |
| ) | |
| fig_f1_inf.update_traces(textposition="top center") | |
| # fig_f1_inf.show() | |
| # | |
| # График FLOPs Inference vs Accuracy | |
| fig_acc_inf = px.scatter( | |
| data, x="FLOPs Inference", y="Accuracy", text="Adapter", | |
| title=f"FLOPs Inference vs Accuracy{title}", labels={"FLOPs Inference": "FLOPs (Inference)", "Accuracy": "Accuracy"} | |
| ) | |
| fig_acc_inf.update_traces(textposition="top center") | |
| # fig_acc_inf.show() | |
| # График FLOPs Train Full vs F1-score | |
| fig_f1_train = px.scatter( | |
| data, x="FLOPs Train Full", y="F1-score", text="Adapter", | |
| title=f"FLOPs Train Full vs F1-score{title}", labels={"FLOPs Train Full": "FLOPs (Train)", "F1-score": "F1-score"} | |
| ) | |
| fig_f1_train.update_traces(textposition="top center") | |
| # fig_f1_train.show() | |
| # График FLOPs Train Full vs Accuracy | |
| fig_acc_train = px.scatter( | |
| data, x="FLOPs Train Full", y="Accuracy", text="Adapter", | |
| title=f"FLOPs Train Full vs Accuracy{title}", labels={"FLOPs Train Full": "FLOPs (Train)", "Accuracy": "Accuracy"} | |
| ) | |
| fig_acc_train.update_traces(textposition="top center") | |
| # fig_acc_train.show() | |
| # | |
| return fig_f1_inf, fig_acc_inf, fig_f1_train, fig_acc_train | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# Autointent") | |
| fig1, fig2, fig3, fig4 = create_plots("data.json", " (ENG)") | |
| gr.Plot(fig1) | |
| gr.Plot(fig2) | |
| gr.Plot(fig3) | |
| gr.Plot(fig4) | |
| fig1_, fig2_, fig3_, fig4_ = create_plots("data2.json", " (RU)") | |
| gr.Plot(fig1_) | |
| gr.Plot(fig2_) | |
| gr.Plot(fig3_) | |
| gr.Plot(fig4_) | |
| demo.launch() | |