ai-replace-prompt
A Dart package designed to streamline the generation and management of prompts for AI-powered image replacement tasks. This utility simplifies the process of creating effective prompts to achieve desired transformations.
Installation
To use ai-replace-prompt in your Dart project, add it as a dependency in your pubspec.yaml file:
yaml
dependencies:
ai_replace_prompt: ^1.0.0 # Replace with the latest version
Then, run dart pub get to install the package.
Usage Examples
Here are several examples demonstrating how to use the ai-replace-prompt package:
1. Simple Replacement: dart import 'package:ai_replace_prompt/ai_replace_prompt.dart';
void main() { final promptGenerator = PromptGenerator(); final prompt = promptGenerator.generateSimpleReplacePrompt( targetObject: 'a red apple', replacementObject: 'a green apple', ); print(prompt); // Output: Replace the red apple with a green apple. }
2. Replacement with Context: dart import 'package:ai_replace_prompt/ai_replace_prompt.dart';
void main() { final promptGenerator = PromptGenerator(); final prompt = promptGenerator.generateContextualReplacePrompt( targetObject: 'the blue car', replacementObject: 'a vintage red convertible', sceneDescription: 'a sunny beach with palm trees', ); print(prompt); // Output: In a sunny beach scene with palm trees, replace the blue car with a vintage red convertible. }
3. Advanced Prompt with Style and Detail: dart import 'package:ai_replace_prompt/ai_replace_prompt.dart';
void main() { final promptGenerator = PromptGenerator(); final prompt = promptGenerator.generateDetailedReplacePrompt( targetObject: 'a modern office desk', replacementObject: 'an antique wooden writing desk', style: 'Victorian', additionalDetails: 'with intricate carvings and a leather top', ); print(prompt); // Output: Replace the modern office desk with an antique wooden writing desk in a Victorian style, with intricate carvings and a leather top. }
4. Custom Prompt Template: dart import 'package:ai_replace_prompt/ai_replace_prompt.dart';
void main() {
final promptGenerator = PromptGenerator(template: "Transform target into replacement, focusing on details.");
final prompt = promptGenerator.generateCustomPrompt(
{"target": "a cat", "replacement": "a dog", "details": "friendly appearance"}
);
print(prompt); // Output: Transform a cat into a dog, focusing on friendly appearance.
}
5. Using the PromptBuilder for Complex Scenarios: dart import 'package:ai_replace_prompt/ai_replace_prompt.dart';
void main() { final prompt = PromptBuilder() .replace('the old house') .withReplacement('a modern glass building') .inScene('a bustling city center') .style('futuristic') .addDetail('with neon lights') .build();
print(prompt); // Output: Replace the old house with a modern glass building in a bustling city center, in a futuristic style, with neon lights. }
Feature Summary
- Simple Prompt Generation: Easily create basic replacement prompts.
- Contextual Prompts: Add scene descriptions for more accurate transformations.
- Detailed Prompts: Incorporate style and additional details for fine-grained control.
- Customizable Templates: Adapt the prompt structure to your specific needs.
- Prompt Builder: Construct complex prompts step-by-step.
- Null Safety: Built with Dart's sound null safety.
- Easy Integration: Seamlessly integrates into your Dart and Flutter projects.
License
MIT License
This package is part of the ai-replace-prompt ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/blog/best-ai-replace-prompts-to-transform-your-photos-instantly/