Skip to content

Commit d3d4a27

Browse files
preangelleoclaude
andcommitted
fix: improve google/nano-banana image_input parameter handling
- Fixed critical bug where google/nano-banana model requires URLs not local file paths for image_input parameter - Added special handling for nano-banana image_input to skip local paths and show clear warnings - Updated config.py documentation to clearly state nano-banana URL requirements and square format limitation - Enhanced error messages to help users understand nano-banana parameter requirements - Improved parameter validation and user feedback for better debugging experience 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 586b28c commit d3d4a27

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

replicate_batch_process/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@
137137
'specialized': 'high_quality_detailed_images_with_reference',
138138
'scenario': 'premium_quality_generation_with_reference_images',
139139
'reference_image': True,
140-
'description': "Google's Gemini 2.5 Flash Image model (nicknamed 'Nano Banana') - A state-of-the-art image generation model that supports up to 3 reference images for style transfer and context understanding.",
140+
'description': "Google's Gemini 2.5 Flash Image model (nicknamed 'Nano Banana') - A state-of-the-art image generation model that supports up to 3 reference images for style transfer and context understanding. IMPORTANT: Only generates square format (1024x1024) images.",
141141
'supported_params': {
142142
'prompt': {'type': 'str', 'default': None, 'required': True, 'description': 'Text prompt describing the desired image'},
143-
'image_input': {'type': 'list', 'default': None, 'description': 'List of reference image URLs or file paths (maximum 3 images)'},
143+
'image_input': {'type': 'list', 'default': None, 'description': 'List of reference image URLs (maximum 3 images). IMPORTANT: Must be URLs, not local file paths. Local files will be skipped.'},
144144
'output_format': {'type': 'select', 'default': 'jpg', 'options': ['jpg', 'png'], 'description': 'Output image format'}
145145
}
146146
}

replicate_batch_process/main.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,26 @@ def replicate_model_calling(prompt, model_name, **kwargs):
418418
# Add parameters from kwargs that are supported by the model
419419
for param_name, param_config in supported_params.items():
420420
if param_name in current_kwargs:
421-
# Handle file inputs specially
421+
# Handle special cases for google/nano-banana image_input (requires URLs only)
422+
if model_name == 'google/nano-banana' and param_name == 'image_input':
423+
image_list = current_kwargs[param_name]
424+
if isinstance(image_list, list):
425+
url_list = []
426+
for img in image_list:
427+
if isinstance(img, str):
428+
if img.startswith(('http://', 'https://')):
429+
url_list.append(img)
430+
else:
431+
print(f"⚠️ google/nano-banana requires URLs for image_input, not file paths: {img}")
432+
print(f" Skipping local file path. Upload to a hosting service first.")
433+
if url_list:
434+
input_params[param_name] = url_list
435+
print(f"📁 Using {len(url_list)} image URLs for nano-banana")
436+
else:
437+
print(f"⚠️ No valid URLs found for google/nano-banana image_input parameter")
438+
continue
439+
440+
# Handle other file inputs normally
422441
if param_config.get('type') == 'file' and current_kwargs[param_name] is not None:
423442
file_input = current_kwargs[param_name]
424443
# If it's a string, treat as file path or URL

0 commit comments

Comments
 (0)