curl -X POST "http://localhost:8000/api/generate" \
-H "Content-Type: application/json" \
-d '{
"message": "@create image 貓咪"
}'
import requests
url = "http://localhost:8000/api/generate"
payload = {
"message": "@create image 貓咪"
}
response = requests.post(url, json=payload)
data = response.json()
if data.get("success"):
print("生成成功!圖片 URL:", data.get("image_url"))
# Teammates can also download directly from:
# http://localhost:8000/api/latest
fetch('http://localhost:8000/api/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
message: '@create image 貓咪'
})
})
.then(res => res.json())
.then(data => {
console.log("Image base64:", data.image_base64);
console.log("Image URL:", data.image_url);
});