ru_characters_explorer / data_loader.py
limloop's picture
исправление ошибки
7aaf509
raw
history blame
642 Bytes
from datasets import load_dataset
import pandas as pd
import streamlit as st
@st.cache_data
def load_data():
"""Загрузка и кэширование набора данных"""
dataset = load_dataset("loim/ru_fantasy_characters")
return pd.DataFrame(dataset['train'])
@st.cache_data
def get_unique_mood(_df):
"""Получение уникальных значений настроения"""
return sorted(_df['mood'].unique().tolist())
@st.cache_data
def get_unique_tags(_df):
"""Получение уникальных тегов"""
return sorted({tag for tags in _df['tags'] for tag in tags.split()})