Grok: تحرير الصور
ارفع صورة لتحريرها باستخدام نموذج Grok. أنشئ نسخة معدّلة بمرئيات تعبيرية وطابع سينمائي
تنزيل سير العملجرّبه في Cloud وثائق API
داخل سير العمل
معاينة للقراءة فقط للقالب المصدر. افتحه في Cloud لاستكشاف العُقد وإجراء التغييرات.
Loading the graph
Open full-size workflow preview- المخرج
- صورة
- المؤلف
- ComfyUI
استدعِ هذا النموذج من التعليمة البرمجية الخاصة بك
يستخدم الطلب أدناه المخطط والإعدادات المُعدّة نفسها كما في Playground. يمكن لكل إرسال أن يبدأ تشغيلًا مدفوعًا؛ لا تُعِد تلقائيًا محاولة إرسال لا تُعرف نتيجته.
1 الحصول على مفتاح API ↗
What you need
- Runs on
- Comfy Cloud
- المفتاح
- COMFY_API_KEY
- ملفاتك
- تُرفع بواسطة التعليمة البرمجية من عناوين URL الخاصة بها
يتطلب خطة Cloud مدفوعة ورصيدًا.
تنزيل API JSONوثائق API ↗
# 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({
"3": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Grok",
"images": [
"8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"6": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"8": {
"class_type": "GrokImageEditNode",
"inputs": {
"aspect_ratio": "auto",
"image": [
"6",
0
],
"model": "grok-imagine-image",
"number_of_images": 1,
"prompt": "Keep the elderly clockmaker, his face, his posture, his brass mechanical arm and the bronze chronometer in his hand exactly as they are, in the same place in the picture. Transform everything around him into a bright glass greenhouse at golden hour: the factory windows become tall arched panes full of warm low sunlight, the smokestacks become palm fronds and hanging ferns, and the rain is gone. Let thin flowering vines with tiny white blossoms curl around the brass plates and gears of his mechanical arm. The workbench now holds terracotta seed trays, a watering can and clock parts side by side. Soft dust motes float in the warm light, with gentle green reflections on the polished brass and a calm, hopeful mood.",
"resolution": "1K",
"seed": 517143678
},
"_meta": {
"title": "Grok Image Edit"
}
}
})
workflow.set_input("6", "image", client.assets.from_url("https://comfy.org/catalog-media/e5b33496-2507-45a8-804f-5f5eea6e18f2/2c45eea8-961d-4e8e-ae03-0e034620cd58"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("3"):
output.to_file(output.name)