|
1 | 1 | import { BasicSelect, SelectOption, SelectProps } from "@/components/Select.tsx"; |
2 | 2 | import { batch, Signal, useComputed, useSignal, useSignalEffect } from "@preact/signals"; |
3 | 3 | import classNames from "@/utils/classnames.js"; |
4 | | -import { ProsumerWorkflowFLData } from "@/utils/types.ts"; |
| 4 | +import { ModelSearchResponseItem, ProsumerWorkflowFLData } from "@/utils/types.ts"; |
5 | 5 |
|
6 | 6 | export default function ProsumerStep3(props: { |
7 | 7 | process_name: string; |
8 | 8 | disabled: boolean; |
9 | 9 | fl_process?: ProsumerWorkflowFLData; |
| 10 | + global_models: ModelSearchResponseItem[]; |
10 | 11 | }) { |
11 | 12 | console.log("STEP2 disabled", props.disabled); |
12 | 13 | // const initial_filters = props.criteria |
@@ -64,13 +65,16 @@ export default function ProsumerStep3(props: { |
64 | 65 | // }) |
65 | 66 | // ); |
66 | 67 |
|
| 68 | + const selected_global_model_id = useSignal<number>(0); |
67 | 69 | const aggregationRule = useSignal<string>(props.fl_process?.computation ?? "Simple Averaging"); |
68 | 70 | const num_of_fl_rounds = useSignal<number>(props.fl_process?.number_of_rounds ?? 1); |
69 | 71 | const num_of_iterations = useSignal<number>(props.fl_process?.num_of_iterations ?? 1); |
70 | 72 | const error_num_of_iterations = useSignal<boolean>(false); |
71 | 73 | const solver = useSignal<string>(props.fl_process?.solver ?? "HQS"); // ["HQS", "ADMM"] |
72 | 74 | const denoiser = useSignal<string>(props.fl_process?.denoiser ?? "CNN"); // ["CNN", "Autoencoder", "Transformer"] |
73 | 75 |
|
| 76 | + console.log(props); |
| 77 | + |
74 | 78 | const onChangeAggregationRule = (e: Event) => { |
75 | 79 | const target = e.target as HTMLInputElement; |
76 | 80 | console.log("GOT", target, target.value); |
@@ -197,6 +201,33 @@ export default function ProsumerStep3(props: { |
197 | 201 | <label>Number of FL Rounds</label> |
198 | 202 | <i>numbers</i> |
199 | 203 | </div> |
| 204 | + {props.global_models.length > 0 && ( |
| 205 | + <> |
| 206 | + <h5>Global Models to initialize the FL process</h5> |
| 207 | + <div class="grid large-space"> |
| 208 | + {props.global_models.map((r, index) => ( |
| 209 | + <div class="secondary-container padding s12 m6 l3" id={`model-${index}`}> |
| 210 | + <label class="radio extra"> |
| 211 | + <input |
| 212 | + type="radio" |
| 213 | + name="model" |
| 214 | + value={r.id} |
| 215 | + disabled={props.disabled} |
| 216 | + checked={r.id == selected_global_model_id.peek()} |
| 217 | + /> |
| 218 | + <span>Model {r.name ?? ""} (ID: {r.id} - Size: {r.size ?? ""})</span> |
| 219 | + </label> |
| 220 | + {r.name && <div>Name: {r.name}</div>} |
| 221 | + {r.application_type && <div>Application type: {r.application_type}</div>} |
| 222 | + {r.round && <div>Rounds: {r.round}</div>} |
| 223 | + {r.input && <div>Input: {r.input}</div>} |
| 224 | + {r.output && <div>Output: {r.output}</div>} |
| 225 | + {r.nn_architecture && <div>Architecture: {r.nn_architecture}</div>} |
| 226 | + </div> |
| 227 | + ))} |
| 228 | + </div> |
| 229 | + </> |
| 230 | + )} |
200 | 231 | </p> |
201 | 232 |
|
202 | 233 | {!props.disabled && ( |
|
0 commit comments