@umituz/react-native-ai-generation-content 1.17.229 → 1.17.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/package.json +1 -3
- package/src/domain/README.md +503 -0
- package/src/domains/content-moderation/README.md +363 -0
- package/src/domains/creations/README.md +394 -0
- package/src/domains/face-detection/README.md +395 -0
- package/src/domains/prompts/README.md +387 -0
- package/src/features/ai-hug/README.md +276 -0
- package/src/features/ai-kiss/README.md +276 -0
- package/src/features/anime-selfie/README.md +325 -0
- package/src/features/audio-generation/README.md +370 -0
- package/src/features/colorization/README.md +289 -0
- package/src/features/couple-future/README.md +270 -0
- package/src/features/face-swap/README.md +234 -0
- package/src/features/future-prediction/README.md +281 -0
- package/src/features/hd-touch-up/README.md +309 -0
- package/src/features/image-captioning/README.md +361 -0
- package/src/features/image-to-image/README.md +418 -0
- package/src/features/image-to-video/README.md +369 -0
- package/src/features/inpainting/README.md +302 -0
- package/src/features/meme-generator/README.md +327 -0
- package/src/features/photo-restoration/README.md +286 -0
- package/src/features/remove-background/README.md +292 -0
- package/src/features/remove-object/README.md +352 -0
- package/src/features/replace-background/README.md +288 -0
- package/src/features/script-generator/README.md +362 -0
- package/src/features/shared/README.md +280 -0
- package/src/features/sketch-to-image/README.md +296 -0
- package/src/features/style-transfer/README.md +301 -0
- package/src/features/text-to-image/README.md +228 -0
- package/src/features/text-to-video/README.md +245 -0
- package/src/features/text-to-voice/README.md +335 -0
- package/src/features/upscaling/README.md +247 -0
- package/src/infrastructure/config/README.md +310 -0
- package/src/infrastructure/middleware/README.md +378 -0
- package/src/infrastructure/orchestration/README.md +362 -0
- package/src/infrastructure/services/README.md +382 -0
- package/src/infrastructure/utils/README.md +523 -0
- package/src/infrastructure/wrappers/README.md +336 -0
- package/src/presentation/components/README.md +535 -0
- package/src/presentation/hooks/README.md +380 -0
- package/src/presentation/layouts/README.md +374 -0
- package/src/presentation/screens/README.md +430 -0
- package/src/presentation/layouts/types/.npmignore.tmp +0 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# Style Transfer
|
|
2
|
+
|
|
3
|
+
Apply artistic styles to images using AI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Transform photos into artwork
|
|
8
|
+
- Multiple artistic styles (painting, sketch, watercolor, etc.)
|
|
9
|
+
- Customizable style intensity
|
|
10
|
+
- Preserve image content while changing style
|
|
11
|
+
- High-quality artistic output
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
This feature is part of `@umituz/react-native-ai-generation-content`.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @umituz/react-native-ai-generation-content
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Basic Usage
|
|
22
|
+
|
|
23
|
+
### Using the Hook
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { useStyleTransferFeature } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
import * as ImagePicker from 'react-native-image-picker';
|
|
28
|
+
|
|
29
|
+
function StyleTransferScreen() {
|
|
30
|
+
const [image, setImage] = useState<string | null>(null);
|
|
31
|
+
|
|
32
|
+
const feature = useStyleTransferFeature({
|
|
33
|
+
config: {
|
|
34
|
+
style: 'oil-painting',
|
|
35
|
+
intensity: 0.8,
|
|
36
|
+
onProcessingStart: () => console.log('Applying style...'),
|
|
37
|
+
onProcessingComplete: (result) => console.log('Complete:', result),
|
|
38
|
+
onError: (error) => console.error('Error:', error),
|
|
39
|
+
},
|
|
40
|
+
onSelectImage: async () => {
|
|
41
|
+
const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
|
|
42
|
+
if (result.assets && result.assets[0].uri) {
|
|
43
|
+
const base64 = await convertToBase64(result.assets[0].uri);
|
|
44
|
+
setImage(base64);
|
|
45
|
+
return base64;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
onSaveResult: async (imageUrl) => {
|
|
50
|
+
await saveToGallery(imageUrl);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View>
|
|
56
|
+
<PhotoUploadCard
|
|
57
|
+
image={image}
|
|
58
|
+
onSelectImage={feature.selectImage}
|
|
59
|
+
title="Select Image to Style"
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<StyleSelector
|
|
63
|
+
selectedStyle={feature.state.style}
|
|
64
|
+
onSelectStyle={feature.setStyle}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<IntensitySlider
|
|
68
|
+
value={feature.state.intensity}
|
|
69
|
+
onChange={feature.setIntensity}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<Button
|
|
73
|
+
title="Apply Style"
|
|
74
|
+
onPress={feature.process}
|
|
75
|
+
disabled={!feature.isReady || feature.state.isProcessing}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
{feature.state.isProcessing && (
|
|
79
|
+
<ActivityIndicator />
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
{feature.state.result && (
|
|
83
|
+
<ResultDisplay
|
|
84
|
+
originalImage={image}
|
|
85
|
+
resultImage={feature.state.result.imageUrl}
|
|
86
|
+
onSave={() => feature.saveResult()}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Using the Unified AI Feature Screen
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
98
|
+
|
|
99
|
+
function App() {
|
|
100
|
+
return (
|
|
101
|
+
<AIFeatureScreen
|
|
102
|
+
featureId="style-transfer"
|
|
103
|
+
userId="user-123"
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration Options
|
|
110
|
+
|
|
111
|
+
### Feature Config
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
interface StyleTransferFeatureConfig {
|
|
115
|
+
style?: 'oil-painting' | 'watercolor' | 'sketch' | 'anime' | 'impressionist';
|
|
116
|
+
intensity?: number; // 0.0 - 1.0 (default: 0.8)
|
|
117
|
+
onProcessingStart?: () => void;
|
|
118
|
+
onProcessingComplete?: (result: StyleTransferResult) => void;
|
|
119
|
+
onError?: (error: string) => void;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Processing Options
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
interface StyleTransferOptions {
|
|
127
|
+
style: string; // Style ID
|
|
128
|
+
intensity: number; // How strong the style is (0.0 - 1.0)
|
|
129
|
+
preserveDetails?: boolean; // Maintain original details (default: true)
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Available Styles
|
|
134
|
+
|
|
135
|
+
### Oil Painting
|
|
136
|
+
|
|
137
|
+
Classic oil painting style:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
const result = await feature.process({
|
|
141
|
+
style: 'oil-painting',
|
|
142
|
+
intensity: 0.8,
|
|
143
|
+
preserveDetails: true,
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Watercolor
|
|
148
|
+
|
|
149
|
+
Soft watercolor painting style:
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
const result = await feature.process({
|
|
153
|
+
style: 'watercolor',
|
|
154
|
+
intensity: 0.7,
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Sketch
|
|
159
|
+
|
|
160
|
+
Pencil sketch style:
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
const result = await feature.process({
|
|
164
|
+
style: 'sketch',
|
|
165
|
+
intensity: 0.9,
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Anime
|
|
170
|
+
|
|
171
|
+
Anime/manga style:
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
const result = await feature.process({
|
|
175
|
+
style: 'anime',
|
|
176
|
+
intensity: 0.8,
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Impressionist
|
|
181
|
+
|
|
182
|
+
Impressionist painting style:
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
const result = await feature.process({
|
|
186
|
+
style: 'impressionist',
|
|
187
|
+
intensity: 0.7,
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Usage Flow
|
|
192
|
+
|
|
193
|
+
1. Select **Image** - Choose an image to transform
|
|
194
|
+
2. Choose **Style** - Select the artistic style
|
|
195
|
+
3. Adjust **Intensity** - Control style strength
|
|
196
|
+
4. Tap **Apply** - Start the style transfer
|
|
197
|
+
5. View Result - See the styled image
|
|
198
|
+
6. Save or Share - Save or share the result
|
|
199
|
+
|
|
200
|
+
## Component Examples
|
|
201
|
+
|
|
202
|
+
### Style Selector
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { StylePresetsGrid } from '@umituz/react-native-ai-generation-content';
|
|
206
|
+
|
|
207
|
+
const styles = [
|
|
208
|
+
{ id: 'oil-painting', name: 'Oil Painting', preview: '...' },
|
|
209
|
+
{ id: 'watercolor', name: 'Watercolor', preview: '...' },
|
|
210
|
+
{ id: 'sketch', name: 'Sketch', preview: '...' },
|
|
211
|
+
{ id: 'anime', name: 'Anime', preview: '...' },
|
|
212
|
+
{ id: 'impressionist', name: 'Impressionist', preview: '...' },
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
<StylePresetsGrid
|
|
216
|
+
styles={styles}
|
|
217
|
+
selectedStyle={selectedStyle}
|
|
218
|
+
onSelectStyle={setSelectedStyle}
|
|
219
|
+
/>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Intensity Slider
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { Slider } from 'react-native';
|
|
226
|
+
|
|
227
|
+
<Slider
|
|
228
|
+
minimumValue={0}
|
|
229
|
+
maximumValue={1}
|
|
230
|
+
step={0.1}
|
|
231
|
+
value={intensity}
|
|
232
|
+
onValueChange={setIntensity}
|
|
233
|
+
/>
|
|
234
|
+
|
|
235
|
+
<Text>Style Intensity: {Math.round(intensity * 100)}%</Text>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Before/After Comparison
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
|
|
242
|
+
|
|
243
|
+
{feature.state.result && image && (
|
|
244
|
+
<ResultDisplay
|
|
245
|
+
originalImage={image}
|
|
246
|
+
resultImage={feature.state.result.imageUrl}
|
|
247
|
+
onSave={() => feature.saveResult()}
|
|
248
|
+
onShare={() => shareImage(feature.state.result.imageUrl)}
|
|
249
|
+
/>
|
|
250
|
+
)}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Use Cases
|
|
254
|
+
|
|
255
|
+
### Art Creation
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
// Create artwork from photos
|
|
259
|
+
const result = await feature.process({
|
|
260
|
+
style: 'oil-painting',
|
|
261
|
+
intensity: 0.9,
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Social Media
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
// Create stylized content
|
|
269
|
+
const result = await feature.process({
|
|
270
|
+
style: 'sketch',
|
|
271
|
+
intensity: 0.8,
|
|
272
|
+
});
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Photo Effects
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
// Add artistic effects to photos
|
|
279
|
+
const result = await feature.process({
|
|
280
|
+
style: 'watercolor',
|
|
281
|
+
intensity: 0.7,
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Best Practices
|
|
286
|
+
|
|
287
|
+
1. **Style Selection**: Match style to image content for best results
|
|
288
|
+
2. **Intensity**: Start with 0.7-0.8 for balanced results
|
|
289
|
+
3. **Image Quality**: High-quality images produce better artwork
|
|
290
|
+
4. **Preserve Details**: Enable for photos with important details
|
|
291
|
+
5. **Experiment**: Try different styles to find the best match
|
|
292
|
+
|
|
293
|
+
## Related Features
|
|
294
|
+
|
|
295
|
+
- [Anime Selfie](../anime-selfie) - Convert photos to anime style
|
|
296
|
+
- [Image to Image](../image-to-image) - Transform images with AI
|
|
297
|
+
- [Text to Image](../text-to-image) - Generate artwork from text
|
|
298
|
+
|
|
299
|
+
## License
|
|
300
|
+
|
|
301
|
+
MIT
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Text to Image
|
|
2
|
+
|
|
3
|
+
Generate images from text prompts using AI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Generate images from natural language descriptions
|
|
8
|
+
- Support for multiple aspect ratios and sizes
|
|
9
|
+
- Style presets for different artistic effects
|
|
10
|
+
- Multiple image generation in one request
|
|
11
|
+
- Progress tracking during generation
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
This feature is part of `@umituz/react-native-ai-generation-content`.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @umituz/react-native-ai-generation-content
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Basic Usage
|
|
22
|
+
|
|
23
|
+
### Using the Hook
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { useTextToImageFeature } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
|
|
28
|
+
function TextToImageScreen() {
|
|
29
|
+
const feature = useTextToImageFeature({
|
|
30
|
+
config: {
|
|
31
|
+
model: 'imagen-3',
|
|
32
|
+
onPromptChange: (prompt) => console.log('Prompt changed:', prompt),
|
|
33
|
+
onProcessingStart: () => console.log('Starting generation...'),
|
|
34
|
+
onProcessingComplete: (result) => console.log('Generation complete:', result),
|
|
35
|
+
onError: (error) => console.error('Error:', error),
|
|
36
|
+
},
|
|
37
|
+
userId: 'user-123',
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<View>
|
|
42
|
+
<TextInput
|
|
43
|
+
placeholder="Describe the image you want to create..."
|
|
44
|
+
onChangeText={feature.setPrompt}
|
|
45
|
+
value={feature.state.prompt}
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<Button
|
|
49
|
+
title="Generate Image"
|
|
50
|
+
onPress={() => feature.generate()}
|
|
51
|
+
disabled={!feature.isReady}
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
{feature.state.isProcessing && (
|
|
55
|
+
<Text>Progress: {feature.state.progress}%</Text>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
{feature.state.imageUrl && (
|
|
59
|
+
<Image source={{ uri: feature.state.imageUrl }} />
|
|
60
|
+
)}
|
|
61
|
+
|
|
62
|
+
{feature.state.error && (
|
|
63
|
+
<Text>Error: {feature.state.error}</Text>
|
|
64
|
+
)}
|
|
65
|
+
</View>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Using the Unified AI Feature Screen
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
74
|
+
|
|
75
|
+
function App() {
|
|
76
|
+
return (
|
|
77
|
+
<AIFeatureScreen
|
|
78
|
+
featureId="text-to-image"
|
|
79
|
+
userId="user-123"
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Configuration Options
|
|
86
|
+
|
|
87
|
+
### Feature Config
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
interface TextToImageFeatureConfig {
|
|
91
|
+
model?: string; // AI model to use (default: 'imagen-3')
|
|
92
|
+
onPromptChange?: (prompt: string) => void;
|
|
93
|
+
onProcessingStart?: () => void;
|
|
94
|
+
onProcessingComplete?: (result: TextToImageResult) => void;
|
|
95
|
+
onError?: (error: string) => void;
|
|
96
|
+
buildInput?: (prompt: string, options: TextToImageOptions) => any;
|
|
97
|
+
extractResult?: (response: any) => TextToImageResult;
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Generation Options
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
interface TextToImageOptions {
|
|
105
|
+
aspectRatio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
106
|
+
numberOfImages?: number; // 1-4
|
|
107
|
+
style?: 'realistic' | 'artistic' | 'anime' | '3d' | 'painting';
|
|
108
|
+
negativePrompt?: string;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Advanced Usage
|
|
113
|
+
|
|
114
|
+
### Custom Style Selector
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { StyleSelector } from '@umituz/react-native-ai-generation-content';
|
|
118
|
+
|
|
119
|
+
const styles = [
|
|
120
|
+
{ id: 'realistic', name: 'Realistic', preview: '...' },
|
|
121
|
+
{ id: 'artistic', name: 'Artistic', preview: '...' },
|
|
122
|
+
{ id: 'anime', name: 'Anime', preview: '...' },
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
function MyScreen() {
|
|
126
|
+
const [selectedStyle, setSelectedStyle] = useState('realistic');
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<StyleSelector
|
|
130
|
+
styles={styles}
|
|
131
|
+
selectedStyle={selectedStyle}
|
|
132
|
+
onSelectStyle={setSelectedStyle}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Aspect Ratio Selection
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import { AspectRatioSelector } from '@umituz/react-native-ai-generation-content';
|
|
142
|
+
|
|
143
|
+
function MyScreen() {
|
|
144
|
+
const [aspectRatio, setAspectRatio] = useState('1:1');
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<AspectRatioSelector
|
|
148
|
+
selectedAspectRatio={aspectRatio}
|
|
149
|
+
onSelectAspectRatio={setAspectRatio}
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Examples
|
|
156
|
+
|
|
157
|
+
### Basic Image Generation
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
const result = await feature.generate({
|
|
161
|
+
aspectRatio: '16:9',
|
|
162
|
+
numberOfImages: 2,
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### With Style Preset
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
const result = await feature.generate({
|
|
170
|
+
style: 'artistic',
|
|
171
|
+
negativePrompt: 'blurry, low quality',
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Multiple Images
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
const result = await feature.generate({
|
|
179
|
+
numberOfImages: 4,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Access all generated images
|
|
183
|
+
result.imageUrls.forEach(url => {
|
|
184
|
+
console.log('Generated image:', url);
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Example Prompts
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
const examplePrompts = [
|
|
192
|
+
'A beautiful sunset over mountains with vibrant colors',
|
|
193
|
+
'Futuristic cityscape at night with neon lights',
|
|
194
|
+
'Enchanted forest with magical glowing mushrooms',
|
|
195
|
+
'Cozy coffee shop interior on a rainy day',
|
|
196
|
+
'Dragon flying over snow-capped mountain peaks',
|
|
197
|
+
];
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Error Handling
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
const { state, generate } = useTextToImageFeature({ ...config });
|
|
204
|
+
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (state.error) {
|
|
207
|
+
Alert.alert('Generation Failed', state.error);
|
|
208
|
+
}
|
|
209
|
+
}, [state.error]);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Best Practices
|
|
213
|
+
|
|
214
|
+
1. **Prompt Quality**: Use detailed, descriptive prompts for better results
|
|
215
|
+
2. **Aspect Ratio**: Choose the right aspect ratio for your use case
|
|
216
|
+
3. **Batch Generation**: Generate multiple images to get more options
|
|
217
|
+
4. **Negative Prompts**: Use negative prompts to avoid unwanted elements
|
|
218
|
+
5. **Error Handling**: Always handle errors gracefully in production
|
|
219
|
+
|
|
220
|
+
## Related Features
|
|
221
|
+
|
|
222
|
+
- [Text to Video](../text-to-video) - Generate videos from text
|
|
223
|
+
- [Image to Image](../image-to-image) - Transform images with AI
|
|
224
|
+
- [Style Transfer](../style-transfer) - Apply artistic styles to images
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT
|