Skip to content

Commit

Permalink
vision: fix broken demos (#305)
Browse files Browse the repository at this point in the history
* fix relative path to sample image
* fix panic when running detect on picture with no text
  • Loading branch information
danicat authored and broady committed Sep 11, 2017
1 parent c3f85b6 commit 5bbc8cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions vision/detect/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,12 @@ func detectDocumentText(w io.Writer, file string) error {
return err
}

fmt.Fprintln(w, "Text:")
fmt.Fprintf(w, "%q\n", annotation.Text)
if annotation == nil {
fmt.Fprintln(w, "No text found.")
} else {
fmt.Fprintln(w, "Text:")
fmt.Fprintf(w, "%q\n", annotation.Text)
}

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion vision/vision_quickstart/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func main() {
}

// Sets the name of the image file to annotate.
filename := "vision/testdata/cat.jpg"
filename := "../testdata/cat.jpg"

file, err := os.Open(filename)
if err != nil {
Expand Down

0 comments on commit 5bbc8cf

Please sign in to comment.