p-image-lora

Text-to-image generation with custom LoRA weights from HuggingFace

Overview

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: 250 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

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)

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

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

Required Parameters

ParameterTypeDescription
promptstringText prompt for image generation

LoRA Parameters

ParameterTypeDefaultDescription
lora_weightsstring-HuggingFace URL to LoRA weights. Format: huggingface.co/<owner>/<model-name>[/<lora-weights-file.safetensors>]
lora_scalenumber1How strongly to apply the LoRA. Range: -1 to 3. Use 0.5-0.8 for subtle effects, 1.0 for standard, 1.2-1.5 for stronger effects
hf_api_tokenstring-HuggingFace API token for accessing private LoRAs. Get one at https://huggingface.co/settings/tokens

Generation Parameters

ParameterTypeDefaultDescription
aspect_ratiostring"16:9"Aspect ratio for the image. Options: "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "custom"
widthinteger-Custom width in pixels (256-1440). Only used when aspect_ratio="custom". Must be multiple of 16
heightinteger-Custom height in pixels (256-1440). Only used when aspect_ratio="custom". Must be multiple of 16
seedintegerrandomRandom seed for reproducible generation
prompt_upsamplingbooleanfalseUpsample the prompt with an LLM for enhanced results
disable_safety_checkerbooleanfalseDisable safety checker for generated images