Skip to content

Commit 193c08f

Browse files
committed
fix for swift 5.2 syntax
1 parent 50031bc commit 193c08f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/PerfectTensorFlowDemo/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class LabelImage {
3535

3636
public func match(image: Data) throws -> (Int, Int) {
3737
let g = try TF.Graph()
38-
try g.import(definition: def)
38+
_ = try g.import(definition: def)
3939
let normalized = try constructAndExecuteGraphToNormalizeImage(g, imageBytes: image)
4040
let possibilities = try executeInceptionGraph(g, image: normalized)
41-
guard let m = possibilities.max(), let i = possibilities.index(of: m) else {
41+
guard let m = possibilities.max(), let i = possibilities.firstIndex(of: m) else {
4242
throw TF.Panic.INVALID
4343
}//end guard
4444
return (i, Int(m * 100))
@@ -166,7 +166,7 @@ do {
166166
let lines = try fTag.readString()
167167
tags = lines.split(separator: "\n").map { String(describing: $0) }
168168
try TF.Open()
169-
inceptionModel = try LabelImage( Data(bytes: modelBytes) )
169+
inceptionModel = try LabelImage( Data(modelBytes) )
170170
print("library ready")
171171
try HTTPServer.launch(configurationData: confData)
172172
}catch {

0 commit comments

Comments
 (0)