File size: 1,337 Bytes
a36238b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from typing import Any, NewType, TypedDict

from gradio_client import FileData

Sha256Digest = NewType("Sha256Digest", str)
ETag = NewType("ETag", str)
URIStr = NewType("URIStr", str)

MEDIA_UPLOAD_KIND = "media"
ARTIFACT_BLOB_UPLOAD_KIND = "artifact_blob"


class _ManifestEntryBase(TypedDict):
    path: str
    digest: Sha256Digest | ETag | URIStr
    size: int


class ManifestEntry(_ManifestEntryBase, total=False):
    ref: str


Manifest = list[ManifestEntry]


class LogEntry(TypedDict, total=False):
    project: str
    run: str
    run_id: str | None
    metrics: dict[str, Any]
    step: int | None
    config: dict[str, Any] | None
    log_id: str | None


class SystemLogEntry(TypedDict, total=False):
    project: str
    run: str
    run_id: str | None
    metrics: dict[str, Any]
    timestamp: str
    log_id: str | None


class AlertEntry(TypedDict, total=False):
    project: str
    run: str
    run_id: str | None
    title: str
    text: str | None
    level: str
    step: int | None
    timestamp: str
    alert_id: str | None


class UploadEntry(TypedDict):
    project: str
    run: str | None
    run_id: str | None
    step: int | None
    relative_path: str | None
    uploaded_file: FileData


class ArtifactBlobUploadEntry(TypedDict):
    project: str
    digest: Sha256Digest
    uploaded_file: FileData