Spaces:
Running
Running
Use schema_version 2 workflow.json with references/operators/subjects for proper image display
Browse files- app.py +1 -4
- 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 |
-
"
|
| 3 |
-
"name": "Z
|
| 4 |
-
"
|
|
|
|
|
|
|
|
|
|
| 5 |
{
|
| 6 |
-
"id": "
|
| 7 |
-
"
|
| 8 |
-
"
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
"x": 80,
|
| 12 |
-
"y": 150
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
"width": 220,
|
| 14 |
-
"height":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
"inputs": [
|
| 16 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
],
|
| 18 |
"outputs": [
|
| 19 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
],
|
| 21 |
-
"data": {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
},
|
| 23 |
{
|
| 24 |
-
"id": "
|
| 25 |
-
"
|
|
|
|
|
|
|
| 26 |
"fn": "generate_z_image",
|
| 27 |
-
"
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"y": 150,
|
| 31 |
"width": 220,
|
| 32 |
-
"height":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
"inputs": [
|
| 34 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
],
|
| 36 |
"outputs": [
|
| 37 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
],
|
| 39 |
-
"data": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
}
|
| 41 |
],
|
| 42 |
"edges": [
|
| 43 |
{
|
| 44 |
-
"id": "
|
| 45 |
-
"from_node_id": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
"from_port_id": "out_0",
|
| 47 |
-
"to_node_id": "
|
| 48 |
-
"to_port_id": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
}
|