-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path01_quick_start.py
More file actions
52 lines (39 loc) · 1.53 KB
/
01_quick_start.py
File metadata and controls
52 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
Quick Start Example - Your First ComfyKit Program
This is the simplest way to use ComfyKit. Just 3 lines of code!
"""
import asyncio
from comfykit import ComfyKit
async def main():
print("🚀 ComfyKit Quick Start\n")
print("="*60)
# Step 1: Create ComfyKit instance (connects to local ComfyUI by default)
kit = ComfyKit()
print(f"✓ Connected to ComfyUI at {kit.comfyui_url}")
# Step 2: Execute a workflow
print("\n📝 Executing workflow...")
result = await kit.execute(
"workflows/t2i_by_local_flux.json",
{"prompt": "a beautiful sunset over the ocean"}
)
# Step 3: Check results
print(f"\n✅ Status: {result.status}")
if result.duration:
print(f"✅ Duration: {result.duration:.2f}s")
print(f"✅ Generated {len(result.images)} images")
if result.images:
print(f"\n🖼️ Images:")
for i, img in enumerate(result.images, 1):
print(f" {i}. {img}")
# Verify (acts as test)
assert result.status in ["completed", "error"], "Should have valid status"
print("\n" + "="*60)
print("✨ Quick start completed successfully!")
print("\nNext: Check out 02_configuration.py to learn about configuration options")
if __name__ == "__main__":
try:
asyncio.run(main())
except Exception as e:
print(f"\n❌ Error: {e}")
print("\n💡 Tip: Make sure ComfyUI is running at http://127.0.0.1:8188")
print(" Or set COMFYUI_BASE_URL to point to your ComfyUI server")