from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
result = client.v1.ai_face_editor.generate(
assets={
"image_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/tomcruise.png"
},
style={
"enhance_face": False,
"eye_gaze_horizontal": 0.0,
"eye_gaze_vertical": 0.0,
"eye_open_ratio": 0.0,
"eyebrow_direction": 100, # Raise eyebrows
"head_pitch": 0.0,
"head_roll": 0.0,
"head_yaw": 0.0,
"lip_open_ratio": 0.0,
"mouth_grim": 0.0,
"mouth_position_horizontal": 0.0,
"mouth_position_vertical": 0.0,
"mouth_pout": 0.0,
"mouth_purse": 0.0,
"mouth_smile": 0.0,
},
name="Face Editor image",
wait_for_completion=True,
download_outputs=True,
download_directory="outputs"
)
if result.status == "complete":
print(f"✅ Face edit complete!")
print(f"Downloaded to: {result.downloaded_paths}")
print(f"Credits charged: {result.credits_charged}")
else:
print(f"❌ Job failed with status: {result.status}")
if hasattr(result, 'error_message'):
print(f"Error: {result.error_message}")