File size: 683 Bytes
0bdbec3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, TypedDict


class ScoreItem(TypedDict):
    image_path: str
    score: float
    violations: List[str]


@dataclass
class ImageArtifact:
    prompt: str
    path: str
    meta: Dict[str, Any] = field(default_factory=dict)


class AppState(TypedDict, total=False):
    user_text: str
    spec: Dict[str, Any]
    spec_text: str
    K: int
    T: int
    round: int
    prompts: List[str]
    images: List[ImageArtifact]
    scores: List[ScoreItem]
    best_image: Optional[ImageArtifact]
    violations: List[str]
    hard_violations: List[str]
    outdir: str