# Content Pipeline

> Build a flow that creates social media content from a prompt.

**URL:** https://inference.sh/docs/examples/content-pipeline
**Last updated:** 2026-09-18

---

Build a flow that creates social media content from a prompt.

---

## What We're Building

A flow that:
1. Generates an image from a description
2. Creates a caption
3. Resizes for different platforms

```
Prompt → Generate Image → Write Caption → Resize → Output
```

---

## Step 1: Create the Flow

1. Go to [Flows](https://app.inference.sh/flows)
2. Click **New Flow**
3. Name it `content-pipeline`

---

## Step 2: Add Input Node

Define what the flow accepts:

```yaml
inputs:
  - name: description
    type: string
    description: "What kind of content to create"
  - name: platform
    type: string
    default: "instagram"
    description: "Target platform"
```

---

## Step 3: Add Image Generation

Add a `stable-diffusion` node:

```yaml
node: generate_image
app: infsh/stable-diffusion
inputs:
  prompt: "{{input.description}}, professional social media content, high quality"
  size: "1024x1024"
```

---

## Step 4: Add Caption Writer

Add a text generation node:

```yaml
node: write_caption
app: infsh/gpt-4
inputs:
  prompt: |
    Write an engaging social media caption for: {{input.description}}
    
    Platform: {{input.platform}}
    
    Include relevant hashtags. Keep it concise and engaging.
```

---

## Step 5: Add Resizer

Add an image resize node:

```yaml
node: resize
app: infsh/image-resize
inputs:
  image: "{{generate_image.output.images[0]}}"
  presets:
    - name: instagram_square
      size: 1080x1080
    - name: instagram_story
      size: 1080x1920
    - name: twitter
      size: 1200x675
```

---

## Step 6: Define Output

```yaml
output:
  image: "{{resize.output.images.instagram_square}}"
  story: "{{resize.output.images.instagram_story}}"
  twitter: "{{resize.output.images.twitter}}"
  caption: "{{write_caption.output.text}}"
```

---

## Running the Flow

```python
from inferencesh import inference

client = inference(api_key="inf_your_key")

result = client.run({
    "app": "myname/content-pipeline",  # After deploying
    "input": {
        "description": "A cozy coffee shop morning",
        "platform": "instagram"
    }
})

print("Caption:", result["output"]["caption"])
print("Images:", result["output"]["image"])
```

---

## Using with an Agent

Add the flow as a tool to an agent:

```
You: Create Instagram content for a coffee shop

Agent: I'll use the content pipeline.
       [Running content-pipeline flow...]
       
       Here's your content:
       
       📸 Image: A warm, cozy coffee shop interior with 
          morning light streaming through windows
       
       ✍️ Caption: "Start your morning the right way ☀️ 
          There's nothing quite like the aroma of fresh 
          coffee and the quiet of early hours.
          #CoffeeLovers #MorningVibes #CafeLife"
       
       I've also generated versions for Stories and Twitter.
       Want me to create more variations?
```

---

## Variations

Extend this flow for different use cases:

- **Product photos**: Add background removal + studio lighting
- **Blog headers**: Add text overlay + branding
- **Thumbnails**: Add YouTube-style text + face detection

---

## Next

→ [Data Processing](/docs/examples/data-processing)
