src.subpages.page
1from dataclasses import dataclass 2from typing import Any 3 4import pandas as pd 5from datasets import Dataset # type: ignore 6from sentence_transformers import SentenceTransformer 7from transformers import AutoModelForSequenceClassification # type: ignore 8from transformers import AutoTokenizer # type: ignore 9 10 11@dataclass 12class Context: 13 """This object facilitates passing around the applications state between different pages.""" 14 15 model: AutoModelForSequenceClassification 16 tokenizer: AutoTokenizer 17 sentence_encoder: SentenceTransformer 18 tags: Any 19 df: pd.DataFrame 20 df_tokens: pd.DataFrame 21 df_tokens_cleaned: pd.DataFrame 22 df_tokens_merged: pd.DataFrame 23 split_sample_size: int 24 ds_name: str 25 ds_config_name: str 26 ds_split_name: str 27 split: Dataset 28 labels: list[str] 29 30 31class Page: 32 """Base class for all pages.""" 33 34 name: str 35 icon: str 36 37 def get_widget_defaults(self): 38 """This function holds the default settings for all the page's widgets. 39 40 Returns: 41 dict: A dictionary of widget defaults, where the keys are the widget names and the values are the default. 42 """ 43 return {} 44 45 def render(self, context): 46 """This function renders the page.""" 47 ...
@dataclass
class
Context:
12@dataclass 13class Context: 14 """This object facilitates passing around the applications state between different pages.""" 15 16 model: AutoModelForSequenceClassification 17 tokenizer: AutoTokenizer 18 sentence_encoder: SentenceTransformer 19 tags: Any 20 df: pd.DataFrame 21 df_tokens: pd.DataFrame 22 df_tokens_cleaned: pd.DataFrame 23 df_tokens_merged: pd.DataFrame 24 split_sample_size: int 25 ds_name: str 26 ds_config_name: str 27 ds_split_name: str 28 split: Dataset 29 labels: list[str]
This object facilitates passing around the applications state between different pages.
Context( model: transformers.models.auto.modeling_auto.AutoModelForSequenceClassification, tokenizer: transformers.models.auto.tokenization_auto.AutoTokenizer, sentence_encoder: sentence_transformers.SentenceTransformer.SentenceTransformer, tags: Any, df: pandas.core.frame.DataFrame, df_tokens: pandas.core.frame.DataFrame, df_tokens_cleaned: pandas.core.frame.DataFrame, df_tokens_merged: pandas.core.frame.DataFrame, split_sample_size: int, ds_name: str, ds_config_name: str, ds_split_name: str, split: datasets.arrow_dataset.Dataset, labels: list[str])
class
Page:
32class Page: 33 """Base class for all pages.""" 34 35 name: str 36 icon: str 37 38 def get_widget_defaults(self): 39 """This function holds the default settings for all the page's widgets. 40 41 Returns: 42 dict: A dictionary of widget defaults, where the keys are the widget names and the values are the default. 43 """ 44 return {} 45 46 def render(self, context): 47 """This function renders the page.""" 48 ...
Base class for all pages.
def
get_widget_defaults(self)
38 def get_widget_defaults(self): 39 """This function holds the default settings for all the page's widgets. 40 41 Returns: 42 dict: A dictionary of widget defaults, where the keys are the widget names and the values are the default. 43 """ 44 return {}
This function holds the default settings for all the page's widgets.
Returns
dict: A dictionary of widget defaults, where the keys are the widget names and the values are the default.