8000 GitHub - AlanSynn/personic: Persona+Image Framework: Generate structured personas and images from action descriptions using Pollinations API · GitHub
[go: up one dir, main page]

Skip to content
AlanSynnPublic

About

Persona+Image Framework: Generate structured personas and images from action descriptions using Pollinations API

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Personic

Persona+Image Framework: Generate structured personas and images from action descriptions using Pollinations API

License: MIT Python 3.11+

Features

  • 2-Stage Generation: Text (persona) → Image (visual representation)
  • Structured Output: Complete PersonaSpec with 15+ fields (role, tone, goals, visual identity, etc.)
  • Multiple Formats: JSON (default) or XML
  • Configurable: Custom models, style presets, aspect ratios, seeds for reproducibility
  • CLI + API: Command-line tool and FastAPI server

Quick Start

Installation

Requirements: Python 3.11+, uv (recommended) or pip

# Clone the repository
git clone https://github.com/yourusername/personic.git
cd personic

# Install with uv (recommended)
uv sync

# Or with pip
pip install -e .

# Configure API key
cp .env.example .env
# Edit .env and add your POLLINATIONS_API_KEY

CLI Usage

# Basic usage
uv run pfw --action "architect drawing on whiteboard"

# With custom parameters
uv run pfw \
  --action "astronaut looking at Earth from space station" \
  --style photoreal \
  --aspect 16:9 \
  --seed-text 2026 \
  --seed-image 2026

# See all options
uv run pfw --help

API Usage

# Start server
uv run uvicorn pfw.api:app --reload

# Make request
curl -X POST http://localhost:8000/generate \
  -H "Content-Type: application/json" \
  -d '{
    "action": "developer coding at a cafe with laptop",
    "style_preset": "photoreal",
    "aspect": "1:1",
    "seed_text": 123,
    "seed_image": 456
  }'

Example Output

{
  "framework_version": "pfw.v1",
  "persona_spec": {
    "persona": {
      "name": "Alex Chen",
      "role": "Frontend Developer",
      "archetype": "The Passionate Coder",
      "tone": {
        "style": ["friendly", "warm"],
        "formality": "casual",
        "emoji": "moderate"
      },
      "goals": ["Improve user experience", "Write clean code"],
      "background": {
        "occupation": "Frontend Developer",
        "skills": ["React", "TypeScript", "UI/UX"]
      },
      "visual_identity": {
        "age_range": "late 20s",
        "outfit": "casual t-shirt and jeans",
        "props": ["laptop", "coffee cup"],
        "colors": ["black", "white", "brown"]
      }
    }
  },
  "artifacts": {
    "image_url": "https://gen.pollinations.ai/image/..."
  }
}

API Reference

Request Parameters

Parameter Type Default Description
action string required Action description (e.g., "architect drawing on whiteboard")
locale string "ko-KR" Locale for persona generation
style_preset string "photoreal" Style: photoreal, anime, 3d, pixel, flat-illustration
aspect string "1:1" Aspect ratio: 1:1 (1024×1024), 16:9 (1344×768), 9:16 (768×1344)
safe boolean false Enable safety filter
return_format string "json" Output format: json or xml
text_model string "nova-fast" Override text generation model
image_model string "klein" Override image generation model
seed_text integer 0 Seed for reproducible text generation
seed_image integer 0 Seed for reproducible image generation
temperature float 0.7 Text generation temperature (0.0-1.0)

Response Structure

See Response Schema below for complete structure.

Key fields:

  • persona_spec.persona: Name, role, tone, goals, values, strengths, flaws, boundaries, speaking rules, tools_behavior, background, visual_identity
  • persona_spec.action_normalized: Short/expanded descriptions, intent, setting, camera details
  • persona_spec.image_prompt: Positive and negative prompts
  • artifacts.image_url: Direct URL to generated image
Full Response Schema (click to expand)
{
  framework_version: string;
  request_id: string;
  created_at: string;               // ISO-8601 timestamp

  models: {
    text: string;
    image: string;
  };

  seeds: {
    text: number;
    image: number;
  };

  input: {
    action: string;
    locale: string;
    style_preset: string;
    aspect: string;
    safe: boolean;
    return_format: string;
  };

  persona_spec: {
    schema_version: string;
    locale: string;
    persona: {
      name: string;
      tagline: string;
      role: string;
      archetype: string;
      tone: {
        style: string[];
        formality: string;
        emoji: string;
      };
      goals: string[];
      non_goals: string[];
      values: string[];
      strengths: string[];
      flaws: string[];
      boundaries: {
        refuse_topics: string[];
        privacy_rules: string[];
      };
      speaking_rules: string[];
      tools_behavior: {
        when_to_ask: string[];
        assumptions_policy: string;
        output_format: string;
      };
      background: {
        world: string;
        occupation: string;
        skills: string[];
        quirks: string[];
      };
      visual_identity: {
        age_range: string;
        gender_presentation: string;
        ethnicity: string;
        hair: string;
        outfit: string;
        props: string[];
        colors: string[];
        style_tags: string[];
      };
    };
    action_normalized: {
      short: string;
      expanded: string;
      intent: string;
      setting: string;
      camera: {
        shot: string;
        lens: string;
        lighting: string;
      };
    };
    image_prompt: {
      positive: string;
      negative: string;
    };
  };

  artifacts: {
    image_url: string;              // Direct URL to generated image
    image_model_params: {
      width: number;
      height: number;
      enhance: boolean;
      transparent: boolean;
    };
  };

  prompts: {
    text_system: string;
    text_user: string;
    image_positive: string;
    image_negative: string;
  };

  notes: string[];
}

How It Works

2-Stage Pipeline

User Input: "architect drawing on whiteboard"
    ↓
[1] Text Generation (LLM)
    ↓
PersonaSpec JSON (name, role, tone, visual_identity, etc.)
    ↓
[2] Image Generation (from persona.image_prompt)
    ↓
Image URL + Complete Response

Architecture

Development

# Install in development mode
uv pip install -e .

# Run tests (when implemented)
pytest

# Format code
black src/
ruff check src/

License

MIT

Contributing

Contributions welcome! Please read CLAUDE.md for AI assistant guidelines.

About

Persona+Image Framework: Generate structured personas and images from action descriptions using Pollinations API

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0