isaac commited on
Commit
cdcf306
·
1 Parent(s): 816a70e

fix: upload named files before predict so intake sees extensions

Browse files

@gradio/client walk_and_store_blobs rewraps every File as a nameless
Blob, so volume uploads fell into the DICOM branch server-side.
Upload original Files via client.upload_files first, then pass
explicit FileData {path, orig_name} to /diagnose.
Verified: tsc clean, build green, shipped diagnoseRemote returns
10 scores + 146 rows against live Space.

Files changed (1) hide show
  1. frontend/src/lib/radar.ts +18 -1
frontend/src/lib/radar.ts CHANGED
@@ -117,7 +117,24 @@ export async function diagnoseRemote(files: File[]): Promise<DiagnoseResult> {
117
  }
118
  let data: unknown[];
119
  try {
120
- const result = await client.predict("/diagnose", { ct_files: files });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  data = result.data as unknown[];
122
  } catch (e) {
123
  // @gradio/client rejects with a status object, not always an Error —
 
117
  }
118
  let data: unknown[];
119
  try {
120
+ // Upload the original Files first: the client's payload walker rewraps
121
+ // every File as a nameless Blob, and server intake routes on the file
122
+ // extension — so predict() receives explicit FileData with orig_name.
123
+ // (upload_files/config are untyped in this client version; the lockfile
124
+ // pins the exact build this was verified against.)
125
+ const root = client.config?.root ?? url;
126
+ const uploaded = await client.upload_files(root, files);
127
+ const paths: string[] = uploaded?.files ?? [];
128
+ if (paths.length !== files.length) {
129
+ throw new Error("GPU busy or unreachable — Retry");
130
+ }
131
+ const result = await client.predict("/diagnose", {
132
+ ct_files: paths.map((path, i) => ({
133
+ path,
134
+ orig_name: files[i].name,
135
+ meta: { _type: "gradio.FileData" },
136
+ })),
137
+ });
138
  data = result.data as unknown[];
139
  } catch (e) {
140
  // @gradio/client rejects with a status object, not always an Error —