gradio-pr-bot commited on
Commit
da68020
·
verified ·
1 Parent(s): 7640e4d

Upload folder using huggingface_hub

Browse files
6.7.0/client/package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "@gradio/client",
3
- "version": "2.0.5",
4
  "description": "Gradio API client",
5
  "type": "module",
6
  "main": "dist/index.js",
 
1
  {
2
  "name": "@gradio/client",
3
+ "version": "2.1.0",
4
  "description": "Gradio API client",
5
  "type": "module",
6
  "main": "dist/index.js",
6.7.0/client/src/client.ts CHANGED
@@ -420,7 +420,7 @@ export class Client {
420
  public async component_server(
421
  component_id: number,
422
  fn_name: string,
423
- data: unknown[] | { binary: boolean; data: Record<string, any> }
424
  ): Promise<unknown> {
425
  if (!this.config) {
426
  throw new Error(CONFIG_ERROR_MSG);
@@ -450,11 +450,12 @@ export class Client {
450
 
451
  let body: FormData | string;
452
 
453
- if ("binary" in data) {
 
454
  body = new FormData();
455
- for (const key in data.data) {
456
  if (key === "binary") continue;
457
- body.append(key, data.data[key]);
458
  }
459
  body.set("component_id", component_id.toString());
460
  body.set("fn_name", fn_name);
 
420
  public async component_server(
421
  component_id: number,
422
  fn_name: string,
423
+ data: unknown | { binary: boolean; data: Record<string, any> }
424
  ): Promise<unknown> {
425
  if (!this.config) {
426
  throw new Error(CONFIG_ERROR_MSG);
 
450
 
451
  let body: FormData | string;
452
 
453
+ if (typeof data === "object" && data !== null && "binary" in data) {
454
+ const _data = data as { binary: boolean; data: Record<string, any> };
455
  body = new FormData();
456
+ for (const key in _data.data) {
457
  if (key === "binary") continue;
458
+ body.append(key, _data.data[key]);
459
  }
460
  body.set("component_id", component_id.toString());
461
  body.set("fn_name", fn_name);