Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| import requests | |
| import json | |
| # Simple test workflow - need EmptyLatentImage node | |
| workflow = { | |
| "1": { | |
| "inputs": { | |
| "ckpt_name": "v1-5-pruned-emaonly.safetensors" | |
| }, | |
| "class_type": "CheckpointLoaderSimple" | |
| }, | |
| "2": { | |
| "inputs": { | |
| "text": "test", | |
| "clip": ["1", 1] | |
| }, | |
| "class_type": "CLIPTextEncode" | |
| }, | |
| "3": { | |
| "inputs": { | |
| "text": "bad", | |
| "clip": ["1", 1] | |
| }, | |
| "class_type": "CLIPTextEncode" | |
| }, | |
| "4": { | |
| "inputs": { | |
| "width": 256, | |
| "height": 256, | |
| "batch_size": 1 | |
| }, | |
| "class_type": "EmptyLatentImage" | |
| }, | |
| "5": { | |
| "inputs": { | |
| "model": ["1", 0], | |
| "positive": ["2", 0], | |
| "negative": ["3", 0], | |
| "latent_image": ["4", 0], | |
| "seed": 42, | |
| "steps": 5, | |
| "cfg": 3.0, | |
| "sampler_name": "euler", | |
| "scheduler": "normal", | |
| "denoise": 1.0 | |
| }, | |
| "class_type": "KSampler" | |
| }, | |
| "6": { | |
| "inputs": { | |
| "samples": ["5", 0], | |
| "vae": ["1", 2] | |
| }, | |
| "class_type": "VAEDecode" | |
| }, | |
| "7": { | |
| "inputs": { | |
| "images": ["6", 0], | |
| "filename_prefix": "test" | |
| }, | |
| "class_type": "SaveImage" | |
| } | |
| } | |
| try: | |
| response = requests.post( | |
| "http://127.0.0.1:8188/prompt", | |
| json={"prompt": workflow}, | |
| timeout=30 | |
| ) | |
| print(f"Status: {response.status_code}") | |
| print(f"Response: {response.text}") | |
| except Exception as e: | |
| print(f"Error: {e}") | |