Built-in Data Type Conversion Example
Demonstrate how to convert between various built-in data types within a workflow. Input any data value and output its converted form.
Sobre
Demonstrate how to convert between various built-in data types within a workflow. Input any data value and output its converted form.
O que você fornece
- Lendo o fluxo de trabalho
É executado no ComfyUI. Este fluxo de trabalho não pode ser executado nesta página. Baixe-o e abra-o no ComfyUI.
Baixar workflowAinda não há exemplos de resultados para este fluxo de trabalho.
Dentro do workflow
Uma prévia somente leitura do gráfico de nós. Abra-o no Comfy Cloud ou faça o download para editar os nós.
Loading the graph
Open full-size workflow preview- Comfy Cloud
- Sim
- Autor
- Autor indisponível
Requer nós personalizados
- Lendo o fluxo de trabalho
Use este fluxo de trabalho a partir do código
Gerado a partir do grafo e das entradas do fluxo de trabalho quando possível; caso contrário, são exibidos exemplos armazenados. Revise as credenciais e os endpoints antes de executar o código, pois isso pode gerar cobranças.
What you need
- Runs on
- Comfy Cloud
- Chave
- COMFY_API_KEY
Requer um plano pago do Cloud e créditos.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"2": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "1"
},
"_meta": {
"title": "Text (Multiline)"
}
},
"3": {
"class_type": "ComfyNumberConvert",
"inputs": {
"value": [
"2",
0
]
},
"_meta": {
"title": "Convert Number"
}
},
"5": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"3",
0
]
},
"_meta": {
"title": "Preview as Text (Float)"
}
},
"6": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"3",
1
]
},
"_meta": {
"title": "Preview as Text (Int)"
}
},
"8": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 0
},
"_meta": {
"title": "Int"
}
},
"9": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"8",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"10": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 1.5
},
"_meta": {
"title": "Float"
}
},
"11": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"10",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"12": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"9",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"13": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"11",
0
]
},
"_meta": {
"title": "Preview as Text (String)"
}
},
"14": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a",
"values.a": [
"8",
0
]
},
"_meta": {
"title": "Math Expression"
}
},
"15": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"14",
2
]
},
"_meta": {
"title": "Preview as Text"
}
},
"16": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"14",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"17": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"14",
1
]
},
"_meta": {
"title": "Preview as Text"
}
},
"18": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a",
"values.a": [
"10",
0
]
},
"_meta": {
"title": "Math Expression"
}
},
"20": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"18",
0
]
},
"_meta": {
"title": "Preview as Text (Float)"
}
},
"21": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"18",
1
]
},
"_meta": {
"title": "Preview as Text (Int)"
}
},
"22": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"18",
2
]
},
"_meta": {
"title": "Preview as Text (Boolean)"
}
},
"23": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a",
"values.a": [
"3",
1
]
},
"_meta": {
"title": "Math Expression"
}
},
"24": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"23",
2
]
},
"_meta": {
"title": "Preview as Text (Boolean)"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)