-
Couldn't load subscription status.
- Fork 1.5k
Styled Imagen UI #1676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styled Imagen UI #1676
Conversation
- use the re-usable InputField component - layout the images in a 2x2 grid - add rounded corners - add a progress overlay Signed-off-by: Peter Friese <peter@peterfriese.de>
Signed-off-by: Peter Friese <peter@peterfriese.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @peterfriese, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request enhances the Imagen UI with several visual and functional improvements. It introduces a unified look and feel using the InputField component, arranges images in a 2x2 grid with rounded corners, adds a progress overlay, and allows users to cancel the image generation process. The changes primarily affect ImagenScreen.swift and ImagenViewModel.swift.
Highlights
- UI Enhancement: The UI is updated to use a reusable
InputFieldcomponent, providing a consistent look and feel across the application. - Layout Improvement: Images are now displayed in a 2x2 grid layout with rounded corners for a more visually appealing presentation.
- Progress Indication: A progress overlay is added to indicate when the image generation process is in progress.
- Cancellation Support: Users can now cancel the image generation process.
Changelog
Click here to see the changelog
- vertexai/ImagenScreen/ImagenScreen.swift
- Imported
GenerativeAIUIComponentsto use theInputFieldcomponent (line 16). - Replaced
TextFieldandButtonwith the newInputFieldfor prompt input and action (lines 31-38). - Implemented a 2x2
LazyVGridto display generated images with rounded corners (lines 42-56). - Added
ProgressOverlayto show loading progress (line 60). - Modified the
onGenerateTappedfunction tosendMessageandsendOrStopto handle both sending messages and stopping the generation (lines 69-80). - Added a
ProgressOverlaystruct to display a loading indicator (lines 85-103).
- Imported
- vertexai/ImagenScreen/ImagenViewModel.swift
- Added
generateImagesTaskto manage the image generation task and enable cancellation (line 38). - Modified
generateImageto usegenerateImagesTaskand allow cancellation of the task (lines 62-85). - Added
stopfunction to cancel the image generation task (lines 87-89).
- Added
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Did you know?
The first digital image was created in 1957, about 20 years before the first digital cameras were invented. It was a scanned image of Russell Kirsch's son, and it was only 176x176 pixels.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request introduces a more visually appealing and functional UI for the Imagen sample, including the use of a reusable InputField component, a 2x2 grid layout for images, rounded corners, a progress overlay, and the ability to cancel image generation. The changes generally improve the user experience. However, there are a few areas that could be improved.
Summary of Findings
- Missing Stop Functionality: The UI includes a stop button, but the corresponding
stop()function inImagenViewModelis not fully implemented. The button is present, but the actual stopping mechanism is commented out, which means the image generation cannot be cancelled. - Focus Management: After generating an image, the focus is set back to the message field. This might interrupt the user if they want to view the generated images.
- Potential Race Condition: There's a potential race condition in
ImagenViewModelwhere multiple calls togenerateImagecould lead to unexpected behavior if the previous task isn't fully cancelled before the new one starts.
Merge Readiness
The pull request introduces significant UI improvements and new functionality. However, the missing stop functionality is a critical issue that needs to be addressed before merging. The focus management and potential race condition should also be considered. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. Due to the critical issue, I recommend that the pull request not be merged until it is addressed.
Signed-off-by: Peter Friese <peter@peterfriese.de>
Signed-off-by: Peter Friese <peter@peterfriese.de>
Signed-off-by: Peter Friese <peter@peterfriese.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Peter! Looks great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much improved. Thanks @peterfriese 💯
InputFieldcomponent for unified look and feel across samples