Spaces:
Running
Running
zach
commited on
Commit
·
db2bd16
1
Parent(s):
f8ddf74
Add global types file
Browse files- src/constants.py +7 -5
- src/types.py +34 -0
src/constants.py
CHANGED
@@ -4,16 +4,18 @@ constants.py
|
|
4 |
This module defines global constants used throughout the project.
|
5 |
"""
|
6 |
|
|
|
|
|
7 |
# UI constants
|
8 |
-
HUME_AI:
|
9 |
-
ELEVENLABS:
|
10 |
-
UNKNOWN_PROVIDER:
|
11 |
|
12 |
PROMPT_MIN_LENGTH: int = 10
|
13 |
PROMPT_MAX_LENGTH: int = 400
|
14 |
|
15 |
-
OPTION_A:
|
16 |
-
OPTION_B:
|
17 |
TROPHY_EMOJI: str = '🏆'
|
18 |
VOTE_FOR_OPTION_A: str = 'Vote for option A'
|
19 |
VOTE_FOR_OPTION_B: str = 'Vote for option B'
|
|
|
4 |
This module defines global constants used throughout the project.
|
5 |
"""
|
6 |
|
7 |
+
from src.types import OptionKey, TTSProviderName
|
8 |
+
|
9 |
# UI constants
|
10 |
+
HUME_AI: TTSProviderName = 'Hume AI'
|
11 |
+
ELEVENLABS: TTSProviderName = 'ElevenLabs'
|
12 |
+
UNKNOWN_PROVIDER: TTSProviderName = 'Unknown'
|
13 |
|
14 |
PROMPT_MIN_LENGTH: int = 10
|
15 |
PROMPT_MAX_LENGTH: int = 400
|
16 |
|
17 |
+
OPTION_A: OptionKey = 'Option A'
|
18 |
+
OPTION_B: OptionKey = 'Option B'
|
19 |
TROPHY_EMOJI: str = '🏆'
|
20 |
VOTE_FOR_OPTION_A: str = 'Vote for option A'
|
21 |
VOTE_FOR_OPTION_B: str = 'Vote for option B'
|
src/types.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
types.py
|
3 |
+
|
4 |
+
This module defines custom types for the application to enforce the structure
|
5 |
+
of the options map used in the user interface. This ensures that each option
|
6 |
+
has a consistent structure including both the provider and the associated voice.
|
7 |
+
"""
|
8 |
+
|
9 |
+
from typing import TypedDict, Literal, Dict
|
10 |
+
|
11 |
+
|
12 |
+
TTSProviderName = Literal['Hume AI', 'ElevenLabs', 'Unknown']
|
13 |
+
"""TTSProviderName represents the allowed provider names for TTS services."""
|
14 |
+
|
15 |
+
|
16 |
+
class OptionDetails(TypedDict):
|
17 |
+
"""
|
18 |
+
A typed dictionary representing the details of an option.
|
19 |
+
|
20 |
+
Attributes:
|
21 |
+
provider (TTSProviderName): The name of the provider (either 'Hume AI' or 'ElevenLabs').
|
22 |
+
voice (str): The name of the voice associated with the option.
|
23 |
+
"""
|
24 |
+
provider: TTSProviderName
|
25 |
+
voice: str
|
26 |
+
|
27 |
+
|
28 |
+
OptionKey = Literal['Option A', 'Option B']
|
29 |
+
"""OptionKey is restricted to the literal values 'Option A' or 'Option B'."""
|
30 |
+
|
31 |
+
|
32 |
+
OptionMap = Dict[OptionKey, OptionDetails]
|
33 |
+
"""OptionMap defines the structure of the options mapping, where each key is an OptionKey
|
34 |
+
and the value is an OptionDetails dictionary."""
|