1

GithubJava Vision APIからプロジェクトをダウンロードしました。

開発者コンソールからプロジェクトの課金を有効にし、プロジェクトの client_secret を取得しました。GOOGLE_APPLICATION_CREDENTIALS後で、client_secret ファイルを指す環境変数を追加します。ラベリング、顔検出、ランドマーク検出など、他のすべての操作を実行できます。text_detection コードを実行しようとすると、これらのエラーが発生します。ここで画像を参照してください

public void indexDirectory(Path inputPath) throws IOException {
List<Path> unprocessedImages =
    Files.walk(inputPath)
        .filter(Files::isRegularFile)
        .filter(index::isDocumentUnprocessed)
        .collect(Collectors.toList());
Lists.<Path>partition(unprocessedImages, BATCH_SIZE)
    .stream()
    .map(this::detectText)
    .flatMap(l -> l.stream())
    .filter(this::successfullyDetectedText)
    .map(this::extractDescriptions)
    .forEach(index::addDocument);}

これは私が書いたコードで、以下のエラーが発生しています。

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    Files cannot be resolved to a variable
    Syntax error on tokens, delete these tokens
    Syntax error on tokens, delete these tokens
    Syntax error on token(s), misplaced construct(s)
    Syntax error on tokens, delete these tokens
    Syntax error on token "-", -- expected
    Syntax error on tokens, delete these tokens
    Syntax error on tokens, delete these tokens
    Syntax error on token ":", EnhancedForStatementHeaderInit expected after this token

    at com.google.cloud.vision.samples.text.TextApp.indexDirectory(TextApp.java:158)
    at com.google.cloud.vision.samples.text.TextApp.main(TextApp.java:107)

これらが構文エラーであることはわかっていますが、それでも機能させるための解決策を見つけることができません。

誰でもこれを機能させる方法を教えてください。

4

0 に答える 0