Spaces:
Sleeping
Sleeping
import json | |
import gradio as gr | |
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) | |