File size: 1,024 Bytes
2467ab2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import json
import pandas as pd

with open('results.json', 'r') as file:
    results = json.load(file)

models = [key for key in results.keys()]
demo = gr.Blocks()

df = pd.DataFrame.from_dict(results[models[0]], orient = "index").reset_index()
df.columns = ["Step", "Loss"]
df["Step"] = pd.to_numeric(df["Step"])

def return_results(model_name):
    print(model_name)
    df = pd.DataFrame.from_dict(results[model_name], orient = "index").reset_index()
    df.columns = ["Step", "Loss"]
    df["Step"] = pd.to_numeric(df["Step"])
    return df

with demo:
    with gr.Row():
        title = gr.Markdown(value=f"""# <p style="text-align: center;"> Subnet 38 Model Convergence</p>""")
    with gr.Row():
        dropdown_1 = gr.Dropdown(choices = models, value = models[0])
        button_1 = gr.Button("Submit")
    with gr.Row():
        chart = gr.LinePlot(df, "Step", "Loss")
    
    button_1.click(return_results, dropdown_1, chart)

demo.launch(debug=True, server_name="0.0.0.0", server_port=7860)