@umituz/react-native-ai-generation-content 1.17.229 → 1.17.231

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +346 -0
  3. package/package.json +1 -3
  4. package/src/domain/README.md +503 -0
  5. package/src/domains/content-moderation/README.md +363 -0
  6. package/src/domains/creations/README.md +394 -0
  7. package/src/domains/face-detection/README.md +395 -0
  8. package/src/domains/prompts/README.md +387 -0
  9. package/src/features/ai-hug/README.md +276 -0
  10. package/src/features/ai-kiss/README.md +276 -0
  11. package/src/features/anime-selfie/README.md +325 -0
  12. package/src/features/audio-generation/README.md +370 -0
  13. package/src/features/colorization/README.md +289 -0
  14. package/src/features/couple-future/README.md +270 -0
  15. package/src/features/face-swap/README.md +431 -0
  16. package/src/features/future-prediction/README.md +281 -0
  17. package/src/features/hd-touch-up/README.md +309 -0
  18. package/src/features/image-captioning/README.md +361 -0
  19. package/src/features/image-to-image/README.md +418 -0
  20. package/src/features/image-to-video/README.md +369 -0
  21. package/src/features/inpainting/README.md +302 -0
  22. package/src/features/meme-generator/README.md +327 -0
  23. package/src/features/photo-restoration/README.md +286 -0
  24. package/src/features/remove-background/README.md +292 -0
  25. package/src/features/remove-object/README.md +352 -0
  26. package/src/features/replace-background/README.md +288 -0
  27. package/src/features/script-generator/README.md +362 -0
  28. package/src/features/shared/README.md +280 -0
  29. package/src/features/sketch-to-image/README.md +296 -0
  30. package/src/features/style-transfer/README.md +301 -0
  31. package/src/features/text-to-image/README.md +394 -0
  32. package/src/features/text-to-video/README.md +245 -0
  33. package/src/features/text-to-voice/README.md +335 -0
  34. package/src/features/upscaling/README.md +247 -0
  35. package/src/infrastructure/config/README.md +310 -0
  36. package/src/infrastructure/middleware/README.md +378 -0
  37. package/src/infrastructure/orchestration/README.md +362 -0
  38. package/src/infrastructure/services/README.md +382 -0
  39. package/src/infrastructure/utils/README.md +523 -0
  40. package/src/infrastructure/wrappers/README.md +336 -0
  41. package/src/presentation/components/README.md +535 -0
  42. package/src/presentation/components/result/ResultStoryCard.tsx +1 -6
  43. package/src/presentation/hooks/README.md +380 -0
  44. package/src/presentation/layouts/README.md +374 -0
  45. package/src/presentation/screens/README.md +430 -0
  46. package/src/presentation/types/result-config.types.ts +3 -3
  47. package/src/presentation/layouts/types/.npmignore.tmp +0 -0
@@ -0,0 +1,280 @@
1
+ # Shared Features
2
+
3
+ Common functionality and utilities shared across multiple AI features.
4
+
5
+ ## Overview
6
+
7
+ This directory contains shared components, hooks, and utilities used by multiple features. It provides reusable implementations for common patterns like dual image/video processing.
8
+
9
+ ## Features
10
+
11
+ - **Dual Image/Video Processing**: Shared logic for features that require two inputs
12
+ - **Common Hooks**: Reusable hooks for similar feature patterns
13
+ - **Type Definitions**: Shared TypeScript types and interfaces
14
+ - **Utilities**: Common helper functions
15
+
16
+ ## Installation
17
+
18
+ This is part of `@umituz/react-native-ai-generation-content`.
19
+
20
+ ```bash
21
+ npm install @umituz/react-native-ai-generation-content
22
+ ```
23
+
24
+ ## Dual Image/Video Processing
25
+
26
+ Many AI features require two images or videos as input (e.g., face swap, AI hug, AI kiss). The dual image/video processing module provides a shared implementation for these features.
27
+
28
+ ### Data Types
29
+
30
+ #### DualImageVideoProcessingStartData
31
+
32
+ ```tsx
33
+ interface DualImageVideoProcessingStartData {
34
+ sourceImageOrVideo: string; // Base64 of source image/video
35
+ targetImageOrVideo: string; // Base64 of target image/video
36
+ options?: Record<string, any>;
37
+ }
38
+ ```
39
+
40
+ #### DualImageVideoResult
41
+
42
+ ```tsx
43
+ interface DualImageVideoResult {
44
+ success: boolean;
45
+ result?: {
46
+ imageUrl?: string;
47
+ videoUrl?: string;
48
+ thumbnailUrl?: string;
49
+ metadata?: Record<string, any>;
50
+ };
51
+ error?: string;
52
+ }
53
+ ```
54
+
55
+ #### DualImageVideoFeatureConfig
56
+
57
+ ```tsx
58
+ interface DualImageVideoFeatureConfig {
59
+ featureType: string; // e.g., 'face-swap', 'ai-hug', 'ai-kiss'
60
+ inputType: 'image' | 'video';
61
+ defaultOptions?: Record<string, any>;
62
+ onProcessingStart?: () => void;
63
+ onProcessingComplete?: (result: DualImageVideoResult) => void;
64
+ onError?: (error: string) => void;
65
+ }
66
+ ```
67
+
68
+ ## Usage Example
69
+
70
+ ### Using Dual Image/Video Processing
71
+
72
+ ```tsx
73
+ import { useDualImageVideoProcessing } from '@umituz/react-native-ai-generation-content';
74
+
75
+ function FaceSwapScreen() {
76
+ const [sourceImage, setSourceImage] = useState<string | null>(null);
77
+ const [targetImage, setTargetImage] = useState<string | null>(null);
78
+
79
+ const {
80
+ state,
81
+ selectSourceImage,
82
+ selectTargetImage,
83
+ process,
84
+ reset,
85
+ isReady,
86
+ } = useDualImageVideoProcessing({
87
+ config: {
88
+ featureType: 'face-swap',
89
+ inputType: 'image',
90
+ defaultOptions: {
91
+ enhanceFace: true,
92
+ matchSkinTone: true,
93
+ },
94
+ onProcessingStart: () => console.log('Starting face swap...'),
95
+ onProcessingComplete: (result) => console.log('Complete:', result),
96
+ onError: (error) => console.error('Error:', error),
97
+ },
98
+ onSelectSourceImage: async () => {
99
+ // Select source image
100
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
101
+ if (result.assets && result.assets[0].uri) {
102
+ const base64 = await convertToBase64(result.assets[0].uri);
103
+ setSourceImage(base64);
104
+ return base64;
105
+ }
106
+ return null;
107
+ },
108
+ onSelectTargetImage: async () => {
109
+ // Select target image
110
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
111
+ if (result.assets && result.assets[0].uri) {
112
+ const base64 = await convertToBase64(result.assets[0].uri);
113
+ setTargetImage(base64);
114
+ return base64;
115
+ }
116
+ return null;
117
+ },
118
+ });
119
+
120
+ return (
121
+ <View>
122
+ <DualImagePicker
123
+ sourceImage={sourceImage}
124
+ targetImage={targetImage}
125
+ onSelectSourceImage={selectSourceImage}
126
+ onSelectTargetImage={selectTargetImage}
127
+ />
128
+
129
+ <Button
130
+ title="Process"
131
+ onPress={process}
132
+ disabled={!isReady || state.isProcessing}
133
+ />
134
+
135
+ {state.isProcessing && <ActivityIndicator />}
136
+
137
+ {state.result && (
138
+ <Image source={{ uri: state.result.result?.imageUrl }} />
139
+ )}
140
+
141
+ {state.error && <Text>Error: {state.error}</Text>}
142
+ </View>
143
+ );
144
+ }
145
+ ```
146
+
147
+ ## State Management
148
+
149
+ ### Processing State
150
+
151
+ ```tsx
152
+ interface DualImageVideoState {
153
+ sourceImageOrVideo: string | null;
154
+ targetImageOrVideo: string | null;
155
+ result: DualImageVideoResult | null;
156
+ isProcessing: boolean;
157
+ progress: number;
158
+ error: string | null;
159
+ }
160
+ ```
161
+
162
+ ## Features Using Dual Image/Video Processing
163
+
164
+ - **Face Swap**: Swap faces between two images
165
+ - **AI Hug**: Generate hug images from two photos
166
+ - **AI Kiss**: Generate kiss images from two photos
167
+ - **Couple Future**: Generate future predictions for couples
168
+
169
+ ## Helper Components
170
+
171
+ ### DualImagePicker
172
+
173
+ ```tsx
174
+ import { DualImagePicker } from '@umituz/react-native-ai-generation-content';
175
+
176
+ <DualImagePicker
177
+ sourceImage={sourceImage}
178
+ targetImage={targetImage}
179
+ onSelectSourceImage={handleSelectSource}
180
+ onSelectTargetImage={handleSelectTarget}
181
+ sourceLabel="First Image"
182
+ targetLabel="Second Image"
183
+ />
184
+ ```
185
+
186
+ ### DualVideoPicker
187
+
188
+ ```tsx
189
+ import { DualVideoPicker } from '@umituz/react-native-ai-generation-content';
190
+
191
+ <DualVideoPicker
192
+ sourceVideo={sourceVideo}
193
+ targetVideo={targetVideo}
194
+ onSelectSourceVideo={handleSelectSource}
195
+ onSelectTargetVideo={handleSelectTarget}
196
+ sourceLabel="First Video"
197
+ targetLabel="Second Video"
198
+ />
199
+ ```
200
+
201
+ ## Advanced Usage
202
+
203
+ ### Custom Processing Logic
204
+
205
+ ```tsx
206
+ import { useDualImageVideoProcessing } from '@umituz/react-native-ai-generation-content';
207
+
208
+ const { process } = useDualImageVideoProcessing({
209
+ config: {
210
+ featureType: 'my-custom-feature',
211
+ inputType: 'image',
212
+ },
213
+ // ... other props
214
+ customProcess: async (source, target, options) => {
215
+ // Custom processing logic
216
+ const result = await myCustomProcessingFunction(source, target, options);
217
+ return result;
218
+ },
219
+ });
220
+ ```
221
+
222
+ ### Validation
223
+
224
+ ```tsx
225
+ const { validate } = useDualImageVideoProcessing({
226
+ // ... config
227
+ validateInput: (source, target) => {
228
+ if (!source || !target) {
229
+ throw new Error('Both images are required');
230
+ }
231
+ if (source.size > MAX_SIZE) {
232
+ throw new Error('Source image is too large');
233
+ }
234
+ if (target.size > MAX_SIZE) {
235
+ throw new Error('Target image is too large');
236
+ }
237
+ return true;
238
+ },
239
+ });
240
+ ```
241
+
242
+ ### Before Process Hook
243
+
244
+ ```tsx
245
+ const { process } = useDualImageVideoProcessing({
246
+ // ... config
247
+ onBeforeProcess: async (source, target) => {
248
+ // Show confirmation dialog
249
+ return new Promise((resolve) => {
250
+ Alert.alert(
251
+ 'Confirm',
252
+ 'Do you want to proceed?',
253
+ [
254
+ { text: 'Cancel', onPress: () => resolve(false) },
255
+ { text: 'OK', onPress: () => resolve(true) },
256
+ ]
257
+ );
258
+ });
259
+ },
260
+ });
261
+ ```
262
+
263
+ ## Best Practices
264
+
265
+ 1. **Input Validation**: Always validate inputs before processing
266
+ 2. **Error Handling**: Handle errors gracefully and show user-friendly messages
267
+ 3. **Progress Tracking**: Show progress to users during processing
268
+ 4. **Confirmation**: Use confirmation dialogs for destructive operations
269
+ 5. **State Reset**: Reset state after successful operations
270
+
271
+ ## Related Features
272
+
273
+ - [Face Swap](../face-swap) - Swap faces between images
274
+ - [AI Hug](../ai-hug) - Generate AI hug images
275
+ - [AI Kiss](../ai-kiss) - Generate AI kiss images
276
+ - [Couple Future](../couple-future) - Generate future couple predictions
277
+
278
+ ## License
279
+
280
+ MIT
@@ -0,0 +1,296 @@
1
+ # Sketch to Image
2
+
3
+ Convert hand-drawn sketches and doodles into realistic images using AI.
4
+
5
+ ## Features
6
+
7
+ - Transform rough sketches into detailed images
8
+ - Support for various sketch styles
9
+ - Multiple output styles (realistic, artistic, etc.)
10
+ - Automatic detail enhancement
11
+ - Color and texture 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 { useSketchToImageFeature } from '@umituz/react-native-ai-generation-content';
27
+ import * as ImagePicker from 'react-native-image-picker';
28
+
29
+ function SketchToImageScreen() {
30
+ const [sketch, setSketch] = useState<string | null>(null);
31
+
32
+ const feature = useSketchToImageFeature({
33
+ config: {
34
+ outputStyle: 'realistic',
35
+ prompt: 'A beautiful landscape',
36
+ onProcessingStart: () => console.log('Converting sketch...'),
37
+ onProcessingComplete: (result) => console.log('Complete:', result),
38
+ onError: (error) => console.error('Error:', error),
39
+ },
40
+ onSelectSketch: 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
+ setSketch(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={sketch}
58
+ onSelectImage={feature.selectSketch}
59
+ title="Upload Your Sketch"
60
+ />
61
+
62
+ <OutputStyleSelector
63
+ selectedStyle={feature.state.outputStyle}
64
+ onSelectStyle={feature.setOutputStyle}
65
+ />
66
+
67
+ <PromptInput
68
+ prompt={feature.state.prompt}
69
+ onChangePrompt={feature.setPrompt}
70
+ placeholder="Describe what you drew..."
71
+ />
72
+
73
+ <Button
74
+ title="Convert to Image"
75
+ onPress={feature.process}
76
+ disabled={!feature.isReady || feature.state.isProcessing}
77
+ />
78
+
79
+ {feature.state.isProcessing && (
80
+ <ActivityIndicator />
81
+ )}
82
+
83
+ {feature.state.result && (
84
+ <ResultDisplay
85
+ originalImage={sketch}
86
+ resultImage={feature.state.result.imageUrl}
87
+ onSave={() => feature.saveResult()}
88
+ />
89
+ )}
90
+ </View>
91
+ );
92
+ }
93
+ ```
94
+
95
+ ### Using the Unified AI Feature Screen
96
+
97
+ ```tsx
98
+ import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
99
+
100
+ function App() {
101
+ return (
102
+ <AIFeatureScreen
103
+ featureId="sketch-to-image"
104
+ userId="user-123"
105
+ />
106
+ );
107
+ }
108
+ ```
109
+
110
+ ## Configuration Options
111
+
112
+ ### Feature Config
113
+
114
+ ```tsx
115
+ interface SketchToImageFeatureConfig {
116
+ outputStyle?: 'realistic' | 'artistic' | 'anime' | '3d';
117
+ prompt?: string; // Description of the sketch
118
+ onProcessingStart?: () => void;
119
+ onProcessingComplete?: (result: SketchToImageResult) => void;
120
+ onError?: (error: string) => void;
121
+ }
122
+ ```
123
+
124
+ ### Generation Options
125
+
126
+ ```tsx
127
+ interface SketchToImageOptions {
128
+ sketch: string; // Base64 sketch image
129
+ outputStyle: 'realistic' | 'artistic' | 'anime' | '3d';
130
+ prompt?: string; // Optional description
131
+ addColor?: boolean; // Add color to sketch (default: true)
132
+ addDetails?: boolean; // Enhance with details (default: true)
133
+ }
134
+ ```
135
+
136
+ ## Output Styles
137
+
138
+ ### Realistic
139
+
140
+ Photorealistic output:
141
+
142
+ ```tsx
143
+ const result = await feature.process({
144
+ outputStyle: 'realistic',
145
+ addColor: true,
146
+ addDetails: true,
147
+ });
148
+ ```
149
+
150
+ ### Artistic
151
+
152
+ Artistic interpretation:
153
+
154
+ ```tsx
155
+ const result = await feature.process({
156
+ outputStyle: 'artistic',
157
+ });
158
+ ```
159
+
160
+ ### Anime
161
+
162
+ Anime/manga style:
163
+
164
+ ```tsx
165
+ const result = await feature.process({
166
+ outputStyle: 'anime',
167
+ });
168
+ ```
169
+
170
+ ### 3D Render
171
+
172
+ 3D rendered look:
173
+
174
+ ```tsx
175
+ const result = await feature.process({
176
+ outputStyle: '3d',
177
+ });
178
+ ```
179
+
180
+ ## Usage Flow
181
+
182
+ 1. Select **Sketch** - Upload or draw a sketch
183
+ 2. Choose **Output Style** - Select the desired output style
184
+ 3. Add **Prompt** (optional) - Describe what you drew
185
+ 4. Tap **Convert** - Start the conversion
186
+ 5. View **Result** - See the generated image
187
+ 6. Save or Share - Save or share the result
188
+
189
+ ## Component Examples
190
+
191
+ ### Output Style Selector
192
+
193
+ ```tsx
194
+ import { StylePresetsGrid } from '@umituz/react-native-ai-generation-content';
195
+
196
+ const styles = [
197
+ { id: 'realistic', name: 'Realistic', preview: '...' },
198
+ { id: 'artistic', name: 'Artistic', preview: '...' },
199
+ { id: 'anime', name: 'Anime', preview: '...' },
200
+ { id: '3d', name: '3D Render', preview: '...' },
201
+ ];
202
+
203
+ <StylePresetsGrid
204
+ styles={styles}
205
+ selectedStyle={selectedStyle}
206
+ onSelectStyle={setSelectedStyle}
207
+ />
208
+ ```
209
+
210
+ ### Prompt Input
211
+
212
+ ```tsx
213
+ import { TextInput } from 'react-native';
214
+
215
+ <TextInput
216
+ placeholder="Describe what you drew..."
217
+ value={prompt}
218
+ onChangeText={setPrompt}
219
+ multiline
220
+ numberOfLines={3}
221
+ />
222
+ ```
223
+
224
+ ### Before/After Comparison
225
+
226
+ ```tsx
227
+ import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
228
+
229
+ {feature.state.result && sketch && (
230
+ <ResultDisplay
231
+ originalImage={sketch}
232
+ resultImage={feature.state.result.imageUrl}
233
+ onSave={() => feature.saveResult()}
234
+ onShare={() => shareImage(feature.state.result.imageUrl)}
235
+ />
236
+ )}
237
+ ```
238
+
239
+ ## Use Cases
240
+
241
+ ### Concept Art
242
+
243
+ ```tsx
244
+ // Convert rough sketches to detailed concept art
245
+ const result = await feature.process({
246
+ outputStyle: 'realistic',
247
+ prompt: 'Futuristic cityscape',
248
+ });
249
+ ```
250
+
251
+ ### Illustration
252
+
253
+ ```tsx
254
+ // Turn doodles into illustrations
255
+ const result = await feature.process({
256
+ outputStyle: 'artistic',
257
+ });
258
+ ```
259
+
260
+ ### Storyboarding
261
+
262
+ ```tsx
263
+ // Transform storyboard sketches
264
+ const result = await feature.process({
265
+ outputStyle: 'realistic',
266
+ prompt: 'Action scene with characters',
267
+ });
268
+ ```
269
+
270
+ ### Design Mockups
271
+
272
+ ```tsx
273
+ // Convert design sketches to realistic mockups
274
+ const result = await feature.process({
275
+ outputStyle: 'realistic',
276
+ addDetails: true,
277
+ });
278
+ ```
279
+
280
+ ## Best Practices
281
+
282
+ 1. **Clear Sketches**: Use clear, readable sketches
283
+ 2. **Descriptive Prompts**: Provide detailed descriptions
284
+ 3. **Style Selection**: Match style to your use case
285
+ 4. **Multiple Iterations**: Try different styles and prompts
286
+ 5. **Sketch Quality**: Better sketches produce better results
287
+
288
+ ## Related Features
289
+
290
+ - [Text to Image](../text-to-image) - Generate images from text
291
+ - [Image to Image](../image-to-image) - Transform images with AI
292
+ - [Style Transfer](../style-transfer) - Apply artistic styles
293
+
294
+ ## License
295
+
296
+ MIT