Spaces:
Sleeping
Sleeping
Create config.py
Browse files
config.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dataclasses import dataclass
|
2 |
+
from typing import Dict
|
3 |
+
|
4 |
+
@dataclass
|
5 |
+
class Config:
|
6 |
+
MAX_HISTORY_SIZE: int = 1000
|
7 |
+
BATCH_SIZE_LIMIT: int = 50
|
8 |
+
MAX_TEXT_LENGTH: int = 512
|
9 |
+
MIN_WORD_LENGTH: int = 2
|
10 |
+
CACHE_SIZE: int = 128
|
11 |
+
BATCH_PROCESSING_SIZE: int = 8
|
12 |
+
MODEL_CACHE_SIZE: int = 2 # Maximum models to keep in memory
|
13 |
+
|
14 |
+
# Supported languages and models
|
15 |
+
SUPPORTED_LANGUAGES = {
|
16 |
+
'auto': 'Auto Detect',
|
17 |
+
'en': 'English',
|
18 |
+
'zh': 'Chinese',
|
19 |
+
'es': 'Spanish',
|
20 |
+
'fr': 'French',
|
21 |
+
'de': 'German',
|
22 |
+
'sv': 'Swedish'
|
23 |
+
}
|
24 |
+
|
25 |
+
MODELS = {
|
26 |
+
'en': "cardiffnlp/twitter-roberta-base-sentiment-latest",
|
27 |
+
'multilingual': "cardiffnlp/twitter-xlm-roberta-base-sentiment",
|
28 |
+
'zh': "uer/roberta-base-finetuned-dianping-chinese"
|
29 |
+
}
|
30 |
+
|
31 |
+
# Color themes for Plotly
|
32 |
+
THEMES = {
|
33 |
+
'default': {'pos': '#4CAF50', 'neg': '#F44336', 'neu': '#FF9800'},
|
34 |
+
'ocean': {'pos': '#0077BE', 'neg': '#FF6B35', 'neu': '#00BCD4'},
|
35 |
+
'dark': {'pos': '#66BB6A', 'neg': '#EF5350', 'neu': '#FFA726'},
|
36 |
+
'rainbow': {'pos': '#9C27B0', 'neg': '#E91E63', 'neu': '#FF5722'}
|
37 |
+
}
|
38 |
+
|
39 |
+
config = Config()
|