Instructions to use ProTema/first-start with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BERTopic
How to use ProTema/first-start with BERTopic:
from bertopic import BERTopic model = BERTopic.load("ProTema/first-start") - Notebooks
- Google Colab
- Kaggle
Download src/app/providers/ThemeProviders/lib/useTheme.ts from ProTema/first-start: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/ProTema/first-start/resolve/main/src/app/providers/ThemeProviders/lib/useTheme.ts
- Command line
-
hf download hf://ProTema/first-start/src/app/providers/ThemeProviders/lib/useTheme.ts
-
curl -L -o useTheme.ts https://huggingface.co/ProTema/first-start/resolve/main/src/app/providers/ThemeProviders/lib/useTheme.ts
1.22 kB
| import { useContext } from 'react'; | |
| import { LOCAL_STORAGE_THEME_KEY, Theme, ThemeContext } from './ThemeContext'; | |
| interface UseThemeResult { | |
| toggleTheme: (newTheme: Theme) => void; | |
| theme: Theme; | |
| } | |
| export function useTheme(): UseThemeResult { | |
| const { theme, setTheme } = useContext(ThemeContext); | |
| const toggleTheme = (newTheme: Theme) => { | |
| setTheme?.(newTheme); | |
| // Что бы не перетереть доп классы на body меняем только сам класс темы, а остальные оставляем как есть | |
| let bodyClassesArray: any = document.body.className.split(' '); | |
| if (bodyClassesArray.includes('light')) { | |
| bodyClassesArray.splice(bodyClassesArray.indexOf('light'), 1); | |
| } | |
| if (bodyClassesArray.includes('dark')) { | |
| bodyClassesArray.splice(bodyClassesArray.indexOf('dark'), 1); | |
| } | |
| bodyClassesArray = bodyClassesArray.join(' '); | |
| document.body.className = `${bodyClassesArray} ${newTheme || Theme.LIGHT}`; | |
| localStorage.setItem(LOCAL_STORAGE_THEME_KEY, newTheme); | |
| }; | |
| return { | |
| theme: theme || Theme.LIGHT, | |
| toggleTheme, | |
| }; | |
| } | |