p-image-lora
Text-to-image generation with custom LoRA weights from HuggingFace
p-image-lora extends Pruna's p-image model with support for custom LoRA (Low-Rank Adaptation) weights from HuggingFace. Load your own trained LoRAs or community LoRAs to apply unique artistic styles, characters, or concepts to your generations.
Rate Limit: 500 requests per minute
Category: Text-to-Image Generation
Price: 0.005$ / image
Note: LoRAs used with this endpoint must be trained using p-image-trainer. LoRAs trained with other trainers (like p-image-edit-trainer) will not work.
Quickstart
Section titled “Quickstart”Basic Generation with LoRA (Asynchronous)
Section titled “Basic Generation with LoRA (Asynchronous)”curl -X POST 'https://api.pruna.ai/v1/predictions' \ -H 'Content-Type: application/json' \ -H 'apikey: YOUR_API_KEY' \ -H 'Model: p-image-lora' \ -d '{ "input": { "prompt": "A portrait in my custom artistic style", "lora_weights": "huggingface.co/your-username/your-lora-repo", "lora_scale": 1.0, "aspect_ratio": "1:1" } }'Response:
{ "id": "abc123xyz", "model": "p-image-lora", "input": { ... }, "get_url": "https://api.pruna.ai/v1/predictions/status/abc123xyz"}Check status and get results:
curl -X GET 'https://api.pruna.ai/v1/predictions/status/abc123xyz' \ -H 'apikey: YOUR_API_KEY'Basic Generation with LoRA (Synchronous)
Section titled “Basic Generation with LoRA (Synchronous)”curl -X POST 'https://api.pruna.ai/v1/predictions' \ -H 'Content-Type: application/json' \ -H 'apikey: YOUR_API_KEY' \ -H 'Model: p-image-lora' \ -H 'Try-Sync: true' \ -d '{ "input": { "prompt": "A portrait in my custom artistic style", "lora_weights": "huggingface.co/your-username/your-lora-repo", "lora_scale": 1.0, "aspect_ratio": "1:1" } }'Using a Private HuggingFace LoRA
Section titled “Using a Private HuggingFace LoRA”For private LoRA repositories, include your HuggingFace API token:
curl -X POST 'https://api.pruna.ai/v1/predictions' \ -H 'Content-Type: application/json' \ -H 'apikey: YOUR_API_KEY' \ -H 'Model: p-image-lora' \ -d '{ "input": { "prompt": "A landscape in my custom style", "lora_weights": "huggingface.co/your-username/private-lora", "hf_api_token": "hf_xxxxxxxxxxxxxxxxxxxx", "lora_scale": 1.2 } }'Parameters
Section titled “Parameters”Required Parameters
Section titled “Required Parameters”| Parameter | Type | Description |
|---|---|---|
| prompt | string | Text prompt for image generation |
LoRA Parameters
Section titled “LoRA Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
| lora_weights | string | - | HuggingFace URL to LoRA weights. Format: huggingface.co/<owner>/<model-name>[/<lora-weights-file.safetensors>] |
| lora_scale | number | 0.5 | How strongly to apply the LoRA. Range: -1 to 3. 0.5 usually works well for most LoRAs |
| hf_api_token | string | - | HuggingFace API token for accessing private LoRAs. Get one at https://huggingface.co/settings/tokens |
Generation Parameters
Section titled “Generation Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
| aspect_ratio | string | "16:9" | Aspect ratio for the image. Options: "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "custom" |
| width | integer | - | Custom width in pixels (256-1440). Only used when aspect_ratio="custom". Must be multiple of 16 |
| height | integer | - | Custom height in pixels (256-1440). Only used when aspect_ratio="custom". Must be multiple of 16 |
| seed | integer | random | Random seed for reproducible generation |
| prompt_upsampling | boolean | false | Upsample the prompt with an LLM for enhanced results |
| disable_safety_checker | boolean | false | Disable safety checker for generated images |