gradio-pr-bot commited on
Commit
736cdb6
·
verified ·
1 Parent(s): ba80be5

Upload folder using huggingface_hub

Browse files
6.17.1/workflowcanvas/package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "@gradio/workflowcanvas",
3
- "version": "0.2.0",
4
  "description": "Gradio Workflow Canvas component",
5
  "type": "module",
6
  "author": "",
 
1
  {
2
  "name": "@gradio/workflowcanvas",
3
+ "version": "0.2.1",
4
  "description": "Gradio Workflow Canvas component",
5
  "type": "module",
6
  "author": "",
6.17.1/workflowcanvas/workflow/NodeModelPicker.svelte CHANGED
@@ -1,6 +1,10 @@
1
  <script lang="ts">
2
  import { categorizeSpace, TASK_SCHEMAS } from "./node-library";
3
- import { fetchSpaceApi, normalizeOperatorPorts } from "./space-api";
 
 
 
 
4
  import { FEATURED_SPACES, FEATURED_MODELS } from "./featured";
5
  import type { ModalityConfig, SubTab } from "./workflow-modalities";
6
  import SearchIcon from "./icons/SearchIcon.svelte";
@@ -15,6 +19,7 @@
15
  running: boolean;
16
  category: string | null;
17
  pipeline_tag?: string;
 
18
  }
19
 
20
  type Source = "spaces" | "models" | "datasets";
@@ -24,7 +29,6 @@
24
  modality: ModalityConfig;
25
  nodeId?: string;
26
  server?: Record<string, any>;
27
- hfToken?: string;
28
  anchorX?: number;
29
  anchorY?: number;
30
  initialSource?: Source;
@@ -40,7 +44,6 @@
40
  modality,
41
  nodeId,
42
  server = {},
43
- hfToken = "",
44
  anchorX = undefined,
45
  anchorY = undefined,
46
  initialSource = undefined,
@@ -128,7 +131,7 @@
128
  // go to trending so the subtab actually narrows results.
129
  modality.key === "data" || initialSubtab ? "trending" : "featured"
130
  );
131
- let zero_gpu_only = $state(false);
132
 
133
  const featured_results = $derived.by(() => {
134
  if (source === "datasets") return [];
@@ -143,7 +146,8 @@
143
  likes: item.likes ?? 0,
144
  running: true,
145
  category: item.modality,
146
- pipeline_tag: item.pipeline_tag
 
147
  }));
148
  });
149
 
@@ -194,7 +198,8 @@
194
  desc,
195
  s.id
196
  ),
197
- pipeline_tag: s.cardData?.pipeline_tag || s.pipeline_tag || undefined
 
198
  };
199
  });
200
  }
@@ -634,6 +639,7 @@
634
  <button
635
  class="picker-mode-btn"
636
  class:active={active_content_tab === "featured"}
 
637
  onclick={() => {
638
  active_content_tab = "featured";
639
  search_query = "";
@@ -663,7 +669,8 @@
663
  {#if is_spaces}
664
  <label
665
  class="picker-zerogpu-toggle"
666
- title="Show only ZeroGPU Spaces — these scale with your HF credits and rarely hit quota"
 
667
  >
668
  <input type="checkbox" bind:checked={zero_gpu_only} />
669
  <span>ZeroGPU only</span>
@@ -710,8 +717,8 @@
710
  >{space.title ||
711
  (space.id.split("/").pop() ?? space.id)}</span
712
  >
713
- {#if active_content_tab === "featured"}
714
- <span class="space-badge space-badge-featured">Featured</span>
715
  {/if}
716
  {#if space.pipeline_tag}
717
  <span class="space-badge">{space.pipeline_tag}</span>
@@ -855,6 +862,8 @@
855
  gap: 4px;
856
  padding: 6px 16px 0;
857
  flex-shrink: 0;
 
 
858
  }
859
 
860
  .picker-mode-label {
@@ -894,31 +903,57 @@
894
 
895
  .picker-zerogpu-toggle {
896
  margin-left: auto;
 
897
  display: inline-flex;
898
  align-items: center;
899
- gap: 5px;
900
- font-size: 10.5px;
901
- color: #6b6e78;
 
 
 
 
902
  cursor: pointer;
903
  user-select: none;
 
 
 
 
904
  }
905
 
906
  .picker-zerogpu-toggle input {
907
- accent-color: #f97316;
908
- cursor: pointer;
909
- margin: 0;
 
 
910
  }
911
 
912
  .picker-zerogpu-toggle:hover {
913
- color: #a0a2ae;
 
 
 
 
 
 
 
914
  }
915
 
916
  :global(body:not(.dark)) .picker-zerogpu-toggle {
 
917
  color: #6b6e78;
918
  }
919
 
920
  :global(body:not(.dark)) .picker-zerogpu-toggle:hover {
921
- color: #3e4050;
 
 
 
 
 
 
 
922
  }
923
 
924
  :global(body:not(.dark)) .picker-mode-label {
@@ -1059,39 +1094,6 @@
1059
  color: #f97316;
1060
  }
1061
 
1062
- .picker-tabs {
1063
- display: flex;
1064
- gap: 0;
1065
- padding: 8px 10px 0;
1066
- border-bottom: 1px solid #1e1f2a;
1067
- flex-shrink: 0;
1068
- }
1069
-
1070
- .picker-tab {
1071
- padding: 6px 14px;
1072
- border: none;
1073
- border-bottom: 2px solid transparent;
1074
- background: transparent;
1075
- color: #5c5e6a;
1076
- font-family: "Manrope", sans-serif;
1077
- font-size: 12px;
1078
- font-weight: 600;
1079
- cursor: pointer;
1080
- margin-bottom: -1px;
1081
- transition:
1082
- color 0.15s,
1083
- border-color 0.15s;
1084
- }
1085
-
1086
- .picker-tab:hover {
1087
- color: #a0a2ae;
1088
- }
1089
-
1090
- .picker-tab.active {
1091
- color: #d5d6de;
1092
- border-bottom-color: #f97316;
1093
- }
1094
-
1095
  .picker-results {
1096
  flex: 1;
1097
  overflow-y: auto;
@@ -1189,7 +1191,7 @@
1189
  flex-shrink: 0;
1190
  }
1191
 
1192
- .space-badge-featured {
1193
  background: rgba(249, 115, 22, 0.14);
1194
  color: #f97316;
1195
  }
@@ -1290,18 +1292,6 @@
1290
  background: #ffffff;
1291
  }
1292
 
1293
- :global(body:not(.dark)) .picker-tabs {
1294
- border-bottom-color: #e2e4ea;
1295
- }
1296
-
1297
- :global(body:not(.dark)) .picker-tab {
1298
- color: #8b8d98;
1299
- }
1300
-
1301
- :global(body:not(.dark)) .picker-tab.active {
1302
- color: #1a1b25;
1303
- }
1304
-
1305
  :global(body:not(.dark)) .space-row:hover {
1306
  background: #f4f5f8;
1307
  }
@@ -1319,7 +1309,7 @@
1319
  color: #6b6e78;
1320
  }
1321
 
1322
- :global(body:not(.dark)) .space-badge-featured {
1323
  background: rgba(249, 115, 22, 0.12);
1324
  color: #c84a00;
1325
  }
 
1
  <script lang="ts">
2
  import { categorizeSpace, TASK_SCHEMAS } from "./node-library";
3
+ import {
4
+ fetchSpaceApi,
5
+ is_zero_gpu_space,
6
+ normalizeOperatorPorts
7
+ } from "./space-api";
8
  import { FEATURED_SPACES, FEATURED_MODELS } from "./featured";
9
  import type { ModalityConfig, SubTab } from "./workflow-modalities";
10
  import SearchIcon from "./icons/SearchIcon.svelte";
 
19
  running: boolean;
20
  category: string | null;
21
  pipeline_tag?: string;
22
+ zero_gpu?: boolean;
23
  }
24
 
25
  type Source = "spaces" | "models" | "datasets";
 
29
  modality: ModalityConfig;
30
  nodeId?: string;
31
  server?: Record<string, any>;
 
32
  anchorX?: number;
33
  anchorY?: number;
34
  initialSource?: Source;
 
44
  modality,
45
  nodeId,
46
  server = {},
 
47
  anchorX = undefined,
48
  anchorY = undefined,
49
  initialSource = undefined,
 
131
  // go to trending so the subtab actually narrows results.
132
  modality.key === "data" || initialSubtab ? "trending" : "featured"
133
  );
134
+ let zero_gpu_only = $state(true);
135
 
136
  const featured_results = $derived.by(() => {
137
  if (source === "datasets") return [];
 
146
  likes: item.likes ?? 0,
147
  running: true,
148
  category: item.modality,
149
+ pipeline_tag: item.pipeline_tag,
150
+ zero_gpu: item.zero_gpu
151
  }));
152
  });
153
 
 
198
  desc,
199
  s.id
200
  ),
201
+ pipeline_tag: s.cardData?.pipeline_tag || s.pipeline_tag || undefined,
202
+ zero_gpu: is_zero_gpu_space(s)
203
  };
204
  });
205
  }
 
639
  <button
640
  class="picker-mode-btn"
641
  class:active={active_content_tab === "featured"}
642
+ title={is_spaces ? "Curated ZeroGPU Spaces" : "Curated picks"}
643
  onclick={() => {
644
  active_content_tab = "featured";
645
  search_query = "";
 
669
  {#if is_spaces}
670
  <label
671
  class="picker-zerogpu-toggle"
672
+ class:active={zero_gpu_only}
673
+ title="Show only ZeroGPU Spaces — they scale with your HF credits, give consistent ETAs, and have the clearest billing story"
674
  >
675
  <input type="checkbox" bind:checked={zero_gpu_only} />
676
  <span>ZeroGPU only</span>
 
717
  >{space.title ||
718
  (space.id.split("/").pop() ?? space.id)}</span
719
  >
720
+ {#if is_spaces && space.zero_gpu}
721
+ <span class="space-badge space-badge-zerogpu">ZeroGPU</span>
722
  {/if}
723
  {#if space.pipeline_tag}
724
  <span class="space-badge">{space.pipeline_tag}</span>
 
862
  gap: 4px;
863
  padding: 6px 16px 0;
864
  flex-shrink: 0;
865
+ flex-wrap: wrap;
866
+ row-gap: 6px;
867
  }
868
 
869
  .picker-mode-label {
 
903
 
904
  .picker-zerogpu-toggle {
905
  margin-left: auto;
906
+ position: relative;
907
  display: inline-flex;
908
  align-items: center;
909
+ padding: 3px 10px;
910
+ border-radius: 14px;
911
+ border: 1px solid #2a2b36;
912
+ font-family: "Manrope", sans-serif;
913
+ font-size: 11px;
914
+ font-weight: 600;
915
+ color: #8b8d98;
916
  cursor: pointer;
917
  user-select: none;
918
+ transition:
919
+ background 0.12s,
920
+ border-color 0.12s,
921
+ color 0.12s;
922
  }
923
 
924
  .picker-zerogpu-toggle input {
925
+ position: absolute;
926
+ opacity: 0;
927
+ width: 0;
928
+ height: 0;
929
+ pointer-events: none;
930
  }
931
 
932
  .picker-zerogpu-toggle:hover {
933
+ color: #d5d6de;
934
+ border-color: #3a3b48;
935
+ }
936
+
937
+ .picker-zerogpu-toggle.active {
938
+ background: rgba(249, 115, 22, 0.12);
939
+ border-color: rgba(249, 115, 22, 0.35);
940
+ color: #f97316;
941
  }
942
 
943
  :global(body:not(.dark)) .picker-zerogpu-toggle {
944
+ border-color: #e2e4ea;
945
  color: #6b6e78;
946
  }
947
 
948
  :global(body:not(.dark)) .picker-zerogpu-toggle:hover {
949
+ color: #1a1b25;
950
+ border-color: #cdd0d8;
951
+ }
952
+
953
+ :global(body:not(.dark)) .picker-zerogpu-toggle.active {
954
+ background: rgba(249, 115, 22, 0.1);
955
+ border-color: rgba(249, 115, 22, 0.35);
956
+ color: #d65500;
957
  }
958
 
959
  :global(body:not(.dark)) .picker-mode-label {
 
1094
  color: #f97316;
1095
  }
1096
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1097
  .picker-results {
1098
  flex: 1;
1099
  overflow-y: auto;
 
1191
  flex-shrink: 0;
1192
  }
1193
 
1194
+ .space-badge-zerogpu {
1195
  background: rgba(249, 115, 22, 0.14);
1196
  color: #f97316;
1197
  }
 
1292
  background: #ffffff;
1293
  }
1294
 
 
 
 
 
 
 
 
 
 
 
 
 
1295
  :global(body:not(.dark)) .space-row:hover {
1296
  background: #f4f5f8;
1297
  }
 
1309
  color: #6b6e78;
1310
  }
1311
 
1312
+ :global(body:not(.dark)) .space-badge-zerogpu {
1313
  background: rgba(249, 115, 22, 0.12);
1314
  color: #c84a00;
1315
  }
6.17.1/workflowcanvas/workflow/WorkflowCanvas.svelte CHANGED
@@ -1907,7 +1907,6 @@
1907
  initialSource={activePicker.initialSource}
1908
  initialSubtab={activePicker.initialSubtab}
1909
  {server}
1910
- hfToken={auth.hfToken}
1911
  anchorX={activePicker.anchorX}
1912
  anchorY={activePicker.anchorY}
1913
  oncreate={handlePickerCreate}
 
1907
  initialSource={activePicker.initialSource}
1908
  initialSubtab={activePicker.initialSubtab}
1909
  {server}
 
1910
  anchorX={activePicker.anchorX}
1911
  anchorY={activePicker.anchorY}
1912
  oncreate={handlePickerCreate}
6.17.1/workflowcanvas/workflow/featured.ts CHANGED
@@ -14,6 +14,7 @@ export interface FeaturedItem {
14
  modality: string;
15
  pipeline_tag?: string;
16
  likes?: number;
 
17
  }
18
 
19
  export const FEATURED_SPACES: FeaturedItem[] = [
@@ -22,34 +23,39 @@ export const FEATURED_SPACES: FeaturedItem[] = [
22
  title: "FLUX.1 schnell",
23
  description: "Fast, high-quality text-to-image",
24
  modality: "image",
25
- pipeline_tag: "text-to-image"
 
26
  },
27
  {
28
  id: "stabilityai/stable-diffusion-3.5-large",
29
  title: "Stable Diffusion 3.5 Large",
30
  description: "High-fidelity text-to-image",
31
  modality: "image",
32
- pipeline_tag: "text-to-image"
 
33
  },
34
  {
35
  id: "briaai/BRIA-RMBG-2.0",
36
  title: "BRIA Background Removal",
37
  description: "Remove image backgrounds",
38
- modality: "image"
 
39
  },
40
  {
41
  id: "hf-audio/whisper-large-v3-turbo",
42
  title: "Whisper Large v3 Turbo",
43
  description: "Fast speech-to-text",
44
  modality: "audio",
45
- pipeline_tag: "automatic-speech-recognition"
 
46
  },
47
  {
48
  id: "coqui/xtts",
49
  title: "Coqui XTTS",
50
  description: "Multilingual text-to-speech with voice cloning",
51
  modality: "audio",
52
- pipeline_tag: "text-to-speech"
 
53
  }
54
  ];
55
 
 
14
  modality: string;
15
  pipeline_tag?: string;
16
  likes?: number;
17
+ zero_gpu?: boolean;
18
  }
19
 
20
  export const FEATURED_SPACES: FeaturedItem[] = [
 
23
  title: "FLUX.1 schnell",
24
  description: "Fast, high-quality text-to-image",
25
  modality: "image",
26
+ pipeline_tag: "text-to-image",
27
+ zero_gpu: true
28
  },
29
  {
30
  id: "stabilityai/stable-diffusion-3.5-large",
31
  title: "Stable Diffusion 3.5 Large",
32
  description: "High-fidelity text-to-image",
33
  modality: "image",
34
+ pipeline_tag: "text-to-image",
35
+ zero_gpu: true
36
  },
37
  {
38
  id: "briaai/BRIA-RMBG-2.0",
39
  title: "BRIA Background Removal",
40
  description: "Remove image backgrounds",
41
+ modality: "image",
42
+ zero_gpu: true
43
  },
44
  {
45
  id: "hf-audio/whisper-large-v3-turbo",
46
  title: "Whisper Large v3 Turbo",
47
  description: "Fast speech-to-text",
48
  modality: "audio",
49
+ pipeline_tag: "automatic-speech-recognition",
50
+ zero_gpu: true
51
  },
52
  {
53
  id: "coqui/xtts",
54
  title: "Coqui XTTS",
55
  description: "Multilingual text-to-speech with voice cloning",
56
  modality: "audio",
57
+ pipeline_tag: "text-to-speech",
58
+ zero_gpu: true
59
  }
60
  ];
61
 
6.17.1/workflowcanvas/workflow/space-api.ts CHANGED
@@ -2,6 +2,14 @@ import type { PortType, Port } from "./workflow-types";
2
  import { modalityForPort } from "./workflow-modalities";
3
  import type { ModalityConfig } from "./workflow-modalities";
4
 
 
 
 
 
 
 
 
 
5
  export function normalize_space_id(raw: string): string | null {
6
  const trimmed = raw.trim().replace(/\/+$/, "");
7
  if (!trimmed) return null;
 
2
  import { modalityForPort } from "./workflow-modalities";
3
  import type { ModalityConfig } from "./workflow-modalities";
4
 
5
+ export function is_zero_gpu_space(s: any): boolean {
6
+ const tags: string[] = s?.cardData?.tags || s?.tags || [];
7
+ if (tags.includes("zero-gpu") || tags.includes("zerogpu")) return true;
8
+ const hw: string =
9
+ s?.runtime?.hardware || s?.runtime?.requestedHardware || "";
10
+ return hw.toLowerCase().startsWith("zero");
11
+ }
12
+
13
  export function normalize_space_id(raw: string): string | null {
14
  const trimmed = raw.trim().replace(/\/+$/, "");
15
  if (!trimmed) return null;