Advanced Language Model Studio Development #11

In the following “0082 Code to Pick Photo from photo gallery part 1” video, the presenter continues the development process in Xcode to enable users to choose a photo from their iPhone’s gallery. Initially, they incorporate an IBAction for the “Select Photo” button in the code and establish a connection with the corresponding button in the interface. Subsequently, they emphasize the necessity of integrating a delegate method to interact with the UIImagePickerController for selecting photos. To achieve this, they create a function titled “openCamera” to initiate the image picker and assign its delegate to self. The speaker then validates the functionality by pressing the button, successfully accessing the photo library. The subsequent tutorial will address the completion of this feature.

AI Mobile Course

Please sign up here to subscribe to the AI tutorials

In the following “0083 Code to Pick Photo from photo gallery part 2” video, the presenter delves into intercepting user actions when selecting a photo from the gallery via the UIImagePickerController. Following the initiation of the photo gallery and image capture, the code intercepts the image through the implementation of the UIImagePickerControllerDelegate method, namely imagePickerController(_:didFinishPickingMediaWithInfo:). Subsequently, the code verifies whether the selected media is indeed an image and converts it to NSData if required. Additionally, the importance of incorporating the UINavigationControllerDelegate method to dismiss the UIImagePickerController upon completion of the selection process is highlighted. The presenter also addresses a code issue regarding missing parentheses. Moreover, emphasis is placed on the significance of handling scenarios where the user cancels the selection process.

AI Mobile Course

Please sign up here to subscribe to the AI tutorials

In this video labeled “0084 UI and Code for iOS interaction with Vision LLM,” the presenter illustrates the process of adjusting the code to directly retrieve data from an image rather than relying on an image URL. This involves updating the existing method within the AI manager interface, modifying the image data variable, and incorporating Base 64 image data as an argument. However, upon attempting to generate a description from the image using the new approach, an error arises due to a socket issue in the backend. To address this, the presenter advises starting the server, after which the image data is successfully generated. Subsequently, the result is exhibited in a text area, and functionality for an activity indicator is introduced. Additionally, the presenter addresses the issue of accessing image features outside the main thread by encapsulating the relevant code within dispatch_async(dispatch_get_main_queue(), ^{}). With this resolved, the presenter demonstrates the successful display of the penguin image and showcases the app’s ability to identify various flowers in differently colored images, expressing enthusiasm for the app’s potential in object identification.

AI Mobile Course

Please sign up here to subscribe to the AI tutorials