akhaliq HF Staff commited on
Commit
d3f0474
·
1 Parent(s): b329ae2

Use schema_version 2 workflow.json with references/operators/subjects for proper image display

Browse files
Files changed (2) hide show
  1. app.py +1 -4
  2. workflow.json +160 -27
app.py CHANGED
@@ -108,10 +108,7 @@ def generate_z_image(prompt: str) -> dict:
108
  raise e
109
 
110
 
111
- demo = gr.Workflow(
112
- bind=[generate_prompt, generate_z_image],
113
- edges=[("generate_prompt", "generate_z_image")],
114
- )
115
 
116
  if __name__ == "__main__":
117
  demo.launch()
 
108
  raise e
109
 
110
 
111
+ demo = gr.Workflow(bind=[generate_prompt, generate_z_image])
 
 
 
112
 
113
  if __name__ == "__main__":
114
  demo.launch()
workflow.json CHANGED
@@ -1,52 +1,185 @@
1
  {
2
- "version": "1",
3
- "name": "Z Image Turbo",
4
- "nodes": [
 
 
 
5
  {
6
- "id": "fn_generate_prompt",
7
- "source": "fn",
8
- "fn": "generate_prompt",
9
- "kind": "transform",
10
- "label": "generate_prompt",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  "x": 80,
12
- "y": 150,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  "width": 220,
14
- "height": 152,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  "inputs": [
16
- {"id": "in_concept", "label": "concept", "type": "text"}
 
 
 
 
 
17
  ],
18
  "outputs": [
19
- {"id": "out_0", "label": "output", "type": "text"}
 
 
 
 
20
  ],
21
- "data": {}
 
 
 
 
22
  },
23
  {
24
- "id": "fn_generate_z_image",
25
- "source": "fn",
 
 
26
  "fn": "generate_z_image",
27
- "kind": "transform",
28
- "label": "generate_z_image",
29
- "x": 360,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  "y": 150,
31
  "width": 220,
32
- "height": 152,
 
 
 
 
 
 
 
 
33
  "inputs": [
34
- {"id": "in_prompt", "label": "prompt", "type": "text"}
 
 
 
 
35
  ],
36
  "outputs": [
37
- {"id": "out_0", "label": "output", "type": "image"}
 
 
 
 
38
  ],
39
- "data": {}
 
 
 
 
 
 
40
  }
41
  ],
42
  "edges": [
43
  {
44
- "id": "edge_0",
45
- "from_node_id": "fn_generate_prompt",
 
 
 
 
 
 
 
 
46
  "from_port_id": "out_0",
47
- "to_node_id": "fn_generate_z_image",
48
- "to_port_id": "in_prompt",
 
 
 
 
 
 
 
 
49
  "type": "text"
 
 
 
 
 
 
 
 
50
  }
51
- ]
 
 
 
52
  }
 
1
  {
2
+ "schema_version": "2",
3
+ "name": "Z-Image-Turbo Workflow",
4
+ "runtime": {
5
+ "default": "client"
6
+ },
7
+ "references": [
8
  {
9
+ "id": "ref_concept",
10
+ "label": "Concept",
11
+ "inputs": [
12
+ {
13
+ "id": "in",
14
+ "label": "Text",
15
+ "type": "text"
16
+ }
17
+ ],
18
+ "outputs": [
19
+ {
20
+ "id": "out",
21
+ "label": "Text",
22
+ "type": "text"
23
+ }
24
+ ],
25
+ "width": 220,
26
+ "height": 163,
27
+ "asset_type": "text",
28
+ "role": "reference",
29
+ "data": {
30
+ "in": "a ginger cat wearing a tiny wizard hat reading a spellbook"
31
+ },
32
  "x": 80,
33
+ "y": 150
34
+ },
35
+ {
36
+ "id": "ref_prompt",
37
+ "label": "Expanded Prompt",
38
+ "inputs": [
39
+ {
40
+ "id": "in",
41
+ "label": "Text",
42
+ "type": "text"
43
+ }
44
+ ],
45
+ "outputs": [
46
+ {
47
+ "id": "out",
48
+ "label": "Text",
49
+ "type": "text"
50
+ }
51
+ ],
52
  "width": 220,
53
+ "height": 163,
54
+ "asset_type": "text",
55
+ "role": "reference",
56
+ "data": {
57
+ "in": ""
58
+ },
59
+ "x": 680,
60
+ "y": 150
61
+ }
62
+ ],
63
+ "operators": [
64
+ {
65
+ "id": "op_generate_prompt",
66
+ "label": "Nemotron Prompt Generator",
67
+ "role": "operator",
68
+ "kind": "fn",
69
+ "fn": "generate_prompt",
70
  "inputs": [
71
+ {
72
+ "id": "in_0",
73
+ "label": "concept",
74
+ "type": "text",
75
+ "required": true
76
+ }
77
  ],
78
  "outputs": [
79
+ {
80
+ "id": "out_0",
81
+ "label": "output",
82
+ "type": "text"
83
+ }
84
  ],
85
+ "data": {},
86
+ "x": 380,
87
+ "y": 150,
88
+ "width": 220,
89
+ "height": 124
90
  },
91
  {
92
+ "id": "op_generate_z_image",
93
+ "label": "Z-Image-Turbo Generator",
94
+ "role": "operator",
95
+ "kind": "fn",
96
  "fn": "generate_z_image",
97
+ "inputs": [
98
+ {
99
+ "id": "in_0",
100
+ "label": "prompt",
101
+ "type": "text",
102
+ "required": true
103
+ }
104
+ ],
105
+ "outputs": [
106
+ {
107
+ "id": "out_0",
108
+ "label": "output",
109
+ "type": "image"
110
+ }
111
+ ],
112
+ "data": {},
113
+ "x": 980,
114
  "y": 150,
115
  "width": 220,
116
+ "height": 124
117
+ }
118
+ ],
119
+ "subjects": [
120
+ {
121
+ "id": "subj_output_z_image",
122
+ "label": "Z-Image Output",
123
+ "role": "subject",
124
+ "asset_type": "image",
125
  "inputs": [
126
+ {
127
+ "id": "in",
128
+ "label": "Image",
129
+ "type": "image"
130
+ }
131
  ],
132
  "outputs": [
133
+ {
134
+ "id": "out",
135
+ "label": "Image",
136
+ "type": "image"
137
+ }
138
  ],
139
+ "data": {
140
+ "in": null
141
+ },
142
+ "x": 1280,
143
+ "y": 150,
144
+ "width": 220,
145
+ "height": 107
146
  }
147
  ],
148
  "edges": [
149
  {
150
+ "id": "edge_1",
151
+ "from_node_id": "ref_concept",
152
+ "from_port_id": "out",
153
+ "to_node_id": "op_generate_prompt",
154
+ "to_port_id": "in_0",
155
+ "type": "text"
156
+ },
157
+ {
158
+ "id": "edge_2",
159
+ "from_node_id": "op_generate_prompt",
160
  "from_port_id": "out_0",
161
+ "to_node_id": "ref_prompt",
162
+ "to_port_id": "in",
163
+ "type": "text"
164
+ },
165
+ {
166
+ "id": "edge_3",
167
+ "from_node_id": "ref_prompt",
168
+ "from_port_id": "out",
169
+ "to_node_id": "op_generate_z_image",
170
+ "to_port_id": "in_0",
171
  "type": "text"
172
+ },
173
+ {
174
+ "id": "edge_4",
175
+ "from_node_id": "op_generate_z_image",
176
+ "from_port_id": "out_0",
177
+ "to_node_id": "subj_output_z_image",
178
+ "to_port_id": "in",
179
+ "type": "image"
180
  }
181
+ ],
182
+ "view": {
183
+ "default": "canvas"
184
+ }
185
  }