Add Imagen 3 Image Generation to Presentation Generator #196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR enhances the Presentation Generator Tool by integrating AI-generated images using Imagen 3, as outlined in the instructions for the 12 Mar - Presentation Generator. Images are now generated for each slide based on its title and content, styled for educational presentations, and stored in Google Cloud Storage (GCS) with public URLs attached to the slide objects. This builds on the develop branch (from PR #189) and completes the core image generation feature. Additionally, comprehensive unit tests have been added to ensure functionality and reliability.
Changes Made
Imagen 3 Integration:
generate_image_with_imagen3
inapp/tools/presentation_generator_updated/slide_generator/tools.py
.imagegeneration@006
model with OAuth authentication viaGOOGLE_APPLICATION_CREDENTIALS
.melis-presentation
GCS bucket.Slide Enhancement:
SlideGenerator.generate_slides()
to callgenerate_image_with_imagen3
for each slide.Slide
model to includeimage_url
(e.g.,https://storage.googleapis.com/melis-presentation/slides/<hex>.jpg
).Prompt Optimization:
twoColumn
→ split design,sectionHeader
→ hero image).sectionHeader
).Unit Tests:
app/tools/presentation_generator_updated/slide_generator/tests/test_core.py
with tests for:Slide
andSlidePresentation
.Fixes:
.env
loading,TypeErrors
in content handling, and Imagen 3401 Unauthorized
errors.Example Output
Input:
['Intro'], 'Python', 'university', 'en'
Output: