Created
December 2, 2019 13:10
-
-
Save anupamchugh/50026962a4ec6d611103027ae4af3d25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import Vision | |
struct ContentView: View { | |
var sourceImage = "source_car" | |
@State var modelData = [ | |
ModelData(id: 0, imageName: "scene"), | |
ModelData(id: 1, imageName: "bike_1"), | |
ModelData(id: 2, imageName: "car_2"), | |
ModelData(id: 3, imageName: "bike_2"), | |
ModelData(id: 4, imageName: "car_1")] | |
var body: some View { | |
NavigationView{ | |
VStack{ | |
Image(sourceImage) | |
.resizable() | |
.frame(width: 200.0, height: 200.0) | |
.scaledToFit() | |
Divider() | |
List{ | |
ForEach(modelData, id: \.id){ | |
model in | |
HStack{ | |
Text(model.distance) | |
.padding(10) | |
Spacer() | |
Image(model.imageName) | |
.resizable() | |
.frame(width: 100.0, height: 100.0) | |
.scaledToFit() | |
} | |
} | |
} | |
}.navigationBarItems( | |
trailing: Button(action: processImages, label: { Text("Process") })) | |
.navigationBarTitle(Text("Vision Image Similarity"), displayMode: .inline) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment