File size: 3,597 Bytes
817dfdc
 
7083032
817dfdc
 
 
 
 
 
 
95c64a1
817dfdc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ad4e699
 
 
817dfdc
 
 
7083032
817dfdc
44f343d
 
 
 
 
 
 
8c8f0ea
 
817dfdc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import type * as ort from "onnxruntime-web";

export type DownscaleAlgorithm = "lanczos" | "area" | "bicubic" | "nearest";

export interface ModelConfigEntry {
  id: string;
  name: string;
  file: string;
  scale?: number;
  size?: number;
  recommended?: boolean;
}

export interface AssetRecord {
  name: string;
  size: number;
  type: string;
  saved: boolean;
  blob: Blob;
  predefined?: boolean;
  modelId?: string;
  scale?: number;
}

export interface ImageInfo {
  width: number;
  height: number;
}

export interface ModelInputPreviewInfo extends ImageInfo {
  sourceWidth: number;
  sourceHeight: number;
  resized: boolean;
  fixed: boolean;
}

export interface RunPreview {
  url: string;
  width: number;
  height: number;
}

export interface ResultInfo {
  resolution: string;
  size: string;
  progress: string;
  tiles: string;
  speed: string;
  totalTime: string;
}

export interface TensorSummary {
  name: string;
  type: string;
  dims: Array<number | string>;
  count: number;
  min: number | null;
  max: number | null;
  mean: number | null;
  sample: number[];
}

export interface CurrentRun {
  createdAt: string;
  modelName: string;
  imageName: string;
  durationMs: number;
  inputSummary: Record<string, unknown>;
  outputs: TensorSummary[];
  primaryOutputName: string;
  preview: RunPreview | null;
}

export interface InspectorControls {
  selectedPredefinedModelId: string;
  autoLoadModel: boolean;
  provider: "webgpu" | "wasm" | "webgl";
  tileSize: string;
  tileBlendingEnabled: boolean;
  seamBlendWidth: string;
  seamCorrectionStrength: string;
  width: string;
  height: string;
  outputScale: string;
  preResizeAlgorithm: DownscaleAlgorithm;
  outputScaleAlgorithm: DownscaleAlgorithm;
  colorCorrectionEnabled: boolean;
  colorCorrectionStrength: string;
  colorCorrectionClip: string;
  filmGrainEnabled: boolean;
  filmGrainAmount: string;
  filmGrainSize: string;
  filmGrainMonochrome: boolean;
  compareWithClassicUpscale: boolean;
  classicCompareAlgorithm: DownscaleAlgorithm;
  optLevel: "all" | "extended" | "basic" | "disabled";
  webgpuLayout: "NCHW" | "NHWC";
  webgpuValidation: "basic" | "full" | "wgpuOnly" | "disabled";
  layout: "nchw" | "nhwc";
  channelOrder: "rgb" | "bgr";
  normalize: boolean;
  mean: string;
  std: string;
}

export interface ModelGroup {
  label: string;
  options: Array<{
    value: string;
    label: string;
  }>;
}

export interface Size {
  width: number;
  height: number;
}

export interface NormalizedMetadata {
  type: string;
  dimensions: Array<number | string | null>;
  dimensionLabels: Array<string | null>;
}

export interface SessionMetadataSummary {
  inputCount: number;
  outputCount: number;
  inputs: Array<
    {
      name: string;
    } & NormalizedMetadata
  >;
  outputs: Array<
    {
      name: string;
    } & NormalizedMetadata
  >;
  primaryInput: ({
    name: string;
  } & NormalizedMetadata) | null;
  primaryOutput: ({
    name: string;
  } & NormalizedMetadata) | null;
}

export interface PreprocessResult {
  tensor: ort.Tensor;
  summary: Record<string, unknown>;
  outputCrop: {
    inputWidth: number;
    inputHeight: number;
    paddedWidth: number;
    paddedHeight: number;
  };
}

export interface DiagnosticsLog {
  secureContext: boolean | null;
  crossOriginIsolated: boolean | null;
  hasSharedArrayBuffer: boolean;
  hasNavigatorGpu: boolean;
  userAgent: string | null;
  adapter?: string;
  adapterInfo?: Record<string, string>;
  features?: string[];
  error?: string;
}

export interface PredefinedModelConfigFile {
  models?: ModelConfigEntry[];
}