Spaces:
Runtime error
Runtime error
File size: 1,146 Bytes
46df0b6 |
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 |
import gradio as gr
import pandas as pd
from widgets.widget_base import Widget
from data_measurements.dataset_statistics import DatasetStatisticsCacheClass as dmt_cls
from utils.dataset_utils import HF_DESC_FIELD
import utils
logs = utils.prepare_logging(__file__)
class DatasetDescription(Widget):
def __init__(self, dataset_name_to_dict):
self.dataset_name_to_dict = dataset_name_to_dict
self.description_markdown = gr.Markdown(render=False)
self.description_df = gr.DataFrame(render=False, wrap=True)
def render(self):
with gr.TabItem("Dataset Description",):
self.description_markdown.render()
self.description_df.render()
def update(self, dstats: dmt_cls):
return {
self.description_markdown: self.dataset_name_to_dict[dstats.dset_name][
dstats.dset_config
][HF_DESC_FIELD],
self.description_df: pd.DataFrame(dstats.dset_peek),
}
def add_events(self, state: gr.State):
pass
@property
def output_components(self):
return [self.description_markdown, self.description_df]
|