Build a flow that creates social media content from a prompt.
What We're Building
A flow that:
- Generates an image from a description
- Creates a caption
- Resizes for different platforms
code
1Prompt → Generate Image → Write Caption → Resize → OutputStep 1: Create the Flow
- Go to Flows
- Click New Flow
- Name it
content-pipeline
Step 2: Add Input Node
Define what the flow accepts:
yaml
1inputs:2 - name: description3 type: string4 description: "What kind of content to create"5 - name: platform6 type: string7 default: "instagram"8 description: "Target platform"Step 3: Add Image Generation
Add a stable-diffusion node:
yaml
1node: generate_image2app: infsh/stable-diffusion3inputs:4 prompt: "{{input.description}}, professional social media content, high quality"5 size: "1024x1024"Step 4: Add Caption Writer
Add a text generation node:
yaml
1node: write_caption2app: infsh/gpt-43inputs:4 prompt: |5 Write an engaging social media caption for: {{input.description}}6 7 Platform: {{input.platform}}8 9 Include relevant hashtags. Keep it concise and engaging.Step 5: Add Resizer
Add an image resize node:
yaml
1node: resize2app: infsh/image-resize3inputs:4 image: "{{generate_image.output.images[0]}}"5 presets:6 - name: instagram_square7 size: 1080x10808 - name: instagram_story9 size: 1080x192010 - name: twitter11 size: 1200x675Step 6: Define Output
yaml
1output:2 image: "{{resize.output.images.instagram_square}}"3 story: "{{resize.output.images.instagram_story}}"4 twitter: "{{resize.output.images.twitter}}"5 caption: "{{write_caption.output.text}}"Running the Flow
python
1from inferencesh import inference2 3client = inference(api_key="inf_your_key")4 5result = client.run({6 "app": "myname/content-pipeline", # After deploying7 "input": {8 "description": "A cozy coffee shop morning",9 "platform": "instagram"10 }11})12 13print("Caption:", result["output"]["caption"])14print("Images:", result["output"]["image"])Using with an Agent
Add the flow as a tool to an agent:
code
1You: Create Instagram content for a coffee shop2 3Agent: I'll use the content pipeline.4 [Running content-pipeline flow...]5 6 Here's your content:7 8 �� Image: A warm, cozy coffee shop interior with 9 morning light streaming through windows10 11 ✍️ Caption: "Start your morning the right way ☀️ 12 There's nothing quite like the aroma of fresh 13 coffee and the quiet of early hours.14 #CoffeeLovers #MorningVibes #CafeLife"15 16 I've also generated versions for Stories and Twitter.17 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