Post

Replies

Boosts

Views

Activity

Reply to Swift Student Challenge Vision
Hi! Thanks for the reply I want it to process through a Create ML file and show the name of the picture. For example, the user would upload a photo of a dish (e.g. Pad Thai) and then the Core ML would tell me what that the food is, in text. The Core ML works fine on a normal Xcode Project but Swift Playgrounds does not recognise the food and just does not identify the food. Thanks :)
Jan ’24
Reply to Swift Student Challenge Vision
Hi thanks for replying: Here is my code: Content View File: import SwiftUI import Vision struct ContentView: View { @State private var showImagePicker: Bool = false @State private var inputImage: UIImage? @State private var classificationLabel: String = "Upload Your Photo and add it your Daily Food Logger" var body: some View { VStack { Text(classificationLabel) .padding() if let inputImage = inputImage { Image(uiImage: inputImage) .resizable() .scaledToFit() } Button("Upload Photos") { self.showImagePicker = true } } .sheet(isPresented: $showImagePicker) { ImagePicker(image: self.$inputImage) } } } #Preview { ContentView() } Image PIckes File: import SwiftUI import UIKit struct ImagePicker: UIViewControllerRepresentable { @Environment(.presentationMode) var presentationMode @Binding var image: UIImage? func makeUIViewController(context: Context) -> UIImagePickerController { let picker = UIImagePickerController() picker.delegate = context.coordinator return picker } func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {} func makeCoordinator() -> Coordinator { Coordinator(self) } class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { var parent: ImagePicker init(_ parent: ImagePicker) { self.parent = parent } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { if let uiImage = info[.originalImage] as? UIImage { parent.image = uiImage } parent.presentationMode.wrappedValue.dismiss() } } }
Jan ’24
Reply to Swift Student Challenge Device Specification
HI Thanks for your reply, Is there any way I can request Apple to judge my app on iPad Pro 12.9 Thanks :)
Replies
Boosts
Views
Activity
Feb ’24
Reply to Reality Composer Project too large for Swift Student Challenge
Thanks :)
Replies
Boosts
Views
Activity
Feb ’24
Reply to Reality Kit on Swift Playgrounds
Thanks for your help :), I got a question about Reality Composer Project. How do I compress a Reality Composer Project as mine is showing up to 125MB. The file size limit is 25 MB for the Swift Student Challenge Thanks
Replies
Boosts
Views
Activity
Feb ’24
Reply to Swift Student Challenge Vision
Hi! Thanks for the reply I want it to process through a Create ML file and show the name of the picture. For example, the user would upload a photo of a dish (e.g. Pad Thai) and then the Core ML would tell me what that the food is, in text. The Core ML works fine on a normal Xcode Project but Swift Playgrounds does not recognise the food and just does not identify the food. Thanks :)
Replies
Boosts
Views
Activity
Jan ’24
Reply to Swift Student Challenge Vision
Hi thanks for replying: Here is my code: Content View File: import SwiftUI import Vision struct ContentView: View { @State private var showImagePicker: Bool = false @State private var inputImage: UIImage? @State private var classificationLabel: String = "Upload Your Photo and add it your Daily Food Logger" var body: some View { VStack { Text(classificationLabel) .padding() if let inputImage = inputImage { Image(uiImage: inputImage) .resizable() .scaledToFit() } Button("Upload Photos") { self.showImagePicker = true } } .sheet(isPresented: $showImagePicker) { ImagePicker(image: self.$inputImage) } } } #Preview { ContentView() } Image PIckes File: import SwiftUI import UIKit struct ImagePicker: UIViewControllerRepresentable { @Environment(.presentationMode) var presentationMode @Binding var image: UIImage? func makeUIViewController(context: Context) -> UIImagePickerController { let picker = UIImagePickerController() picker.delegate = context.coordinator return picker } func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {} func makeCoordinator() -> Coordinator { Coordinator(self) } class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { var parent: ImagePicker init(_ parent: ImagePicker) { self.parent = parent } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { if let uiImage = info[.originalImage] as? UIImage { parent.image = uiImage } parent.presentationMode.wrappedValue.dismiss() } } }
Replies
Boosts
Views
Activity
Jan ’24
Reply to Create ML Swift Student Challenge
Thanks :)
Replies
Boosts
Views
Activity
Jan ’24
Reply to Swift Student Challenge 2024
ThankYou for your help and have a great day :) Much Appreciated :)
Replies
Boosts
Views
Activity
Nov ’23