Spaces:
Running
Running
zach
commited on
Commit
·
701fd0f
1
Parent(s):
7f69677
Add voting results data structure to house voting results
Browse files- src/types.py +22 -6
src/types.py
CHANGED
@@ -1,23 +1,39 @@
|
|
1 |
"""
|
2 |
types.py
|
3 |
|
4 |
-
This module defines custom types for the application
|
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 |
# Standard Library Imports
|
10 |
-
from typing import Literal,
|
11 |
|
12 |
|
13 |
TTSProviderName = Literal["Hume AI", "ElevenLabs"]
|
14 |
"""TTSProviderName represents the allowed provider names for TTS services."""
|
15 |
|
16 |
|
|
|
|
|
|
|
|
|
17 |
OptionKey = Literal["Option A", "Option B"]
|
18 |
"""OptionKey is restricted to the literal values 'Option A' or 'Option B'."""
|
19 |
|
20 |
|
21 |
OptionMap = Dict[OptionKey, TTSProviderName]
|
22 |
-
"""OptionMap defines the structure of the options mapping, where each key is an OptionKey
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
"""
|
2 |
types.py
|
3 |
|
4 |
+
This module defines custom types for the application.
|
|
|
|
|
5 |
"""
|
6 |
|
7 |
# Standard Library Imports
|
8 |
+
from typing import Dict, Literal, TypedDict
|
9 |
|
10 |
|
11 |
TTSProviderName = Literal["Hume AI", "ElevenLabs"]
|
12 |
"""TTSProviderName represents the allowed provider names for TTS services."""
|
13 |
|
14 |
|
15 |
+
ComparisonType = Literal["Hume AI - Hume AI", "Hume AI - ElevenLabs"]
|
16 |
+
"""Comparison type denoting which providers are compared."""
|
17 |
+
|
18 |
+
|
19 |
OptionKey = Literal["Option A", "Option B"]
|
20 |
"""OptionKey is restricted to the literal values 'Option A' or 'Option B'."""
|
21 |
|
22 |
|
23 |
OptionMap = Dict[OptionKey, TTSProviderName]
|
24 |
+
"""OptionMap defines the structure of the options mapping, where each key is an OptionKey and the value is a TTS provider."""
|
25 |
+
|
26 |
+
|
27 |
+
class VotingResults(TypedDict):
|
28 |
+
"""Voting results data structure representing values we want to persist to the votes DB"""
|
29 |
+
|
30 |
+
comparison_type: str
|
31 |
+
winning_provider: TTSProviderName
|
32 |
+
winning_option: OptionKey
|
33 |
+
option_a_provider: TTSProviderName
|
34 |
+
option_b_provider: TTSProviderName
|
35 |
+
option_a_generation_id: str
|
36 |
+
option_b_generation_id: str
|
37 |
+
voice_description: str
|
38 |
+
text: str
|
39 |
+
is_custom_text: bool
|