🚀 API Inference
本項目提供了基於 ModelsLab
的文本到圖像生成的 API 推理服務,能夠根據輸入的文本描述生成超逼真的圖像。
🚀 快速開始
獲取 API 密鑰
你可以從 ModelsLab API 獲取 API 密鑰,無需支付費用。獲取後,將下面代碼中的 your_api_key
替換為你的 API 密鑰,並將 model_id
改為 "afrodite-xl-v2"。
代碼示例
如果你使用 PHP、Node、Java 等語言進行開發,可以查看文檔獲取更多代碼示例:查看文檔。
你可以免費試用該模型:生成圖像。
模型鏈接:查看模型。
查看所有模型:查看模型列表。
💻 使用示例
基礎用法
import requests
import json
url = "https://modelslab.com/api/v6/images/text2img"
payload = json.dumps({
"key": "your_api_key",
"model_id": "afrodite-xl-v2",
"prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K",
"negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime",
"width": "512",
"height": "512",
"samples": "1",
"num_inference_steps": "30",
"safety_checker": "no",
"enhance_prompt": "yes",
"seed": None,
"guidance_scale": 7.5,
"multi_lingual": "no",
"panorama": "no",
"self_attention": "no",
"upscale": "no",
"embeddings": "embeddings_model_id",
"lora": "lora_model_id",
"webhook": None,
"track_id": None
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
優惠信息
💡 使用建議
使用優惠碼 DMGG0RBN 可享受 25% 的折扣。
模型相關圖片
%20photography%20of%20a%20beautiful,%20(exhausted_1.2),%20(sweaty_1.1),%20(shor.jpeg)
📄 許可證
本項目使用的許可證為 creativeml-openrail-m
。