Spaces:
Sleeping
Sleeping
| from dataclasses import dataclass | |
| from typing import Dict | |
| class Config: | |
| MAX_HISTORY_SIZE: int = 1000 | |
| BATCH_SIZE_LIMIT: int = 50 | |
| MAX_TEXT_LENGTH: int = 512 | |
| MIN_WORD_LENGTH: int = 2 | |
| CACHE_SIZE: int = 128 | |
| BATCH_PROCESSING_SIZE: int = 8 | |
| MODEL_CACHE_SIZE: int = 2 # Maximum models to keep in memory | |
| # Supported languages and models | |
| SUPPORTED_LANGUAGES = { | |
| 'auto': 'Auto Detect', | |
| 'en': 'English', | |
| 'zh': 'Chinese', | |
| 'es': 'Spanish', | |
| 'fr': 'French', | |
| 'de': 'German', | |
| 'sv': 'Swedish' | |
| } | |
| MODELS = { | |
| 'en': "cardiffnlp/twitter-roberta-base-sentiment-latest", | |
| 'multilingual': "cardiffnlp/twitter-xlm-roberta-base-sentiment", | |
| 'zh': "uer/roberta-base-finetuned-dianping-chinese" | |
| } | |
| # Color themes for Plotly | |
| THEMES = { | |
| 'default': {'pos': '#4CAF50', 'neg': '#F44336', 'neu': '#FF9800'}, | |
| 'ocean': {'pos': '#0077BE', 'neg': '#FF6B35', 'neu': '#00BCD4'}, | |
| 'dark': {'pos': '#66BB6A', 'neg': '#EF5350', 'neu': '#FFA726'}, | |
| 'rainbow': {'pos': '#9C27B0', 'neg': '#E91E63', 'neu': '#FF5722'} | |
| } | |
| config = Config() |