Spaces:
Sleeping
Sleeping
updated config file
Browse files
config.py
CHANGED
|
@@ -1,73 +1,25 @@
|
|
| 1 |
from typing import Dict, Any, List
|
| 2 |
-
from pydantic import BaseModel, Field
|
| 3 |
from pydantic_settings import BaseSettings
|
| 4 |
|
| 5 |
-
class DifficultyConfig(BaseModel):
|
| 6 |
-
jokers_high_similarity: int
|
| 7 |
-
jokers_medium_similarity: int
|
| 8 |
-
words_per_joker: int
|
| 9 |
-
similarity_threshold: float
|
| 10 |
-
time_limit: int
|
| 11 |
-
|
| 12 |
-
class JokerRangeConfig(BaseModel):
|
| 13 |
-
min: float
|
| 14 |
-
max: float
|
| 15 |
-
|
| 16 |
-
class JokerConfig(BaseModel):
|
| 17 |
-
similarity_ranges: Dict[str, JokerRangeConfig]
|
| 18 |
-
cooldown: int
|
| 19 |
-
|
| 20 |
-
class ScoringConfig(BaseModel):
|
| 21 |
-
base_points: int
|
| 22 |
-
time_bonus: Dict[str, Any]
|
| 23 |
-
joker_penalty: Dict[str, int]
|
| 24 |
-
streak_bonus: Dict[str, Any]
|
| 25 |
-
|
| 26 |
-
class GameRulesConfig(BaseModel):
|
| 27 |
-
max_attempts: int
|
| 28 |
-
min_word_length: int
|
| 29 |
-
show_target_word: bool
|
| 30 |
-
allow_partial_matches: bool
|
| 31 |
-
|
| 32 |
-
class GameConfig(BaseModel):
|
| 33 |
-
difficulty: Dict[str, DifficultyConfig]
|
| 34 |
-
jokers: JokerConfig
|
| 35 |
-
scoring: ScoringConfig
|
| 36 |
-
rules: GameRulesConfig
|
| 37 |
-
interface: Dict[str, Any]
|
| 38 |
-
word_selection: Dict[str, Any]
|
| 39 |
-
progression: Dict[str, Any]
|
| 40 |
-
|
| 41 |
class Settings(BaseSettings):
|
| 42 |
model_config = {
|
| 43 |
'protected_namespaces': (),
|
| 44 |
'env_prefix': "SEMANTIX_"
|
| 45 |
}
|
| 46 |
|
| 47 |
-
#
|
| 48 |
app_name: str = "Semantix ML API"
|
| 49 |
version: str = "1.0.0"
|
| 50 |
debug: bool = False
|
| 51 |
model_url: str = "https://huggingface.co/Miroir/cc.fr.300.reduced/resolve/main/cc.fr.300.reduced.vec"
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
"""Get the current game configuration based on difficulty."""
|
| 58 |
-
return GameConfig(**self.game_config)
|
| 59 |
-
|
| 60 |
-
def get_current_difficulty_config(self) -> DifficultyConfig:
|
| 61 |
-
"""Get the current difficulty configuration."""
|
| 62 |
-
return DifficultyConfig(**self.game_config["difficulty"][self.current_difficulty])
|
| 63 |
|
| 64 |
# Create settings instance
|
| 65 |
settings = Settings()
|
| 66 |
|
| 67 |
-
#
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
# Export default config values as constants
|
| 71 |
-
DEFAULT_SIMILARITY_THRESHOLD = 0.99
|
| 72 |
-
DEFAULT_JOKER_COOLDOWN = 3
|
| 73 |
-
DEFAULT_HISTORY_SIZE = 50
|
|
|
|
| 1 |
from typing import Dict, Any, List
|
|
|
|
| 2 |
from pydantic_settings import BaseSettings
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
class Settings(BaseSettings):
|
| 5 |
model_config = {
|
| 6 |
'protected_namespaces': (),
|
| 7 |
'env_prefix': "SEMANTIX_"
|
| 8 |
}
|
| 9 |
|
| 10 |
+
# ML API settings
|
| 11 |
app_name: str = "Semantix ML API"
|
| 12 |
version: str = "1.0.0"
|
| 13 |
debug: bool = False
|
| 14 |
model_url: str = "https://huggingface.co/Miroir/cc.fr.300.reduced/resolve/main/cc.fr.300.reduced.vec"
|
| 15 |
|
| 16 |
+
# ML model constants
|
| 17 |
+
similarity_threshold: float = 0.99
|
| 18 |
+
default_similar_words_count: int = 20
|
| 19 |
+
cache_size: int = 1000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Create settings instance
|
| 22 |
settings = Settings()
|
| 23 |
|
| 24 |
+
# ML-related constants
|
| 25 |
+
DEFAULT_SIMILARITY_THRESHOLD = 0.99
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|