Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

VisionAPIによる画像の文字起こし機能の実装 #23

Closed
Tracked by #1
book000 opened this issue Oct 4, 2023 · 6 comments · Fixed by #70
Closed
Tracked by #1

VisionAPIによる画像の文字起こし機能の実装 #23

book000 opened this issue Oct 4, 2023 · 6 comments · Fixed by #70

Comments

@book000
Copy link
Member

book000 commented Oct 4, 2023

https://github.com/jaoafa/JDA-VCSpeaker/blob/main/src/main/java/com/jaoafa/jdavcspeaker/Lib/VisionAPI.java

Label detectionはせず、Text detectionのみ行う。

  1. ファイルの拡張子によって、画像かそうでないかを判別し「画像処理」と「ファイル処理」に分ける
  2. 無料範囲内を超えるリクエストになってしまう場合はやめる(ファイル処理へ移行)
  3. 画像ファイルをテンポラリディレクトリにダウンロードする
  4. MimeTypeを取得し、適切なMimeTypeか確認する(ダメならファイル処理に移行)
  5. 画像の中身をmd5などでハッシュ化し、キャッシュが存在するかを確認する
  6. base64で画像ファイルの中身をエンコードする
  7. VisionAPIのエンドポイントへリクエストを投げる。リクエスト回数をカウントする
  8. レスポンスを処理し、文字列・文字の位置を取得し保存する。
  9. 画像を編集し、文字列がどの位置にあるかを示す画像を作成する。
  10. 適宜読み上げたり投稿する。

結果はキャッシュし、ハッシュ値が同じであればキャッシュレスポンスを利用。

@book000 book000 mentioned this issue Oct 4, 2023
@book000 book000 changed the title VisionAPI VisionAPIによる画像の文字起こし機構の実装 Oct 4, 2023
@book000 book000 changed the title VisionAPIによる画像の文字起こし機構の実装 VisionAPIによる画像の文字起こし機能の実装 Oct 4, 2023
@book000
Copy link
Member Author

book000 commented Oct 4, 2023

疑問: Okhttp以外に、なんかマシなHTTPクライアントライブラリはあるのかしら。

@yuuahp
Copy link
Member

yuuahp commented Oct 4, 2023

たぶん VoiceTextAPI と同じで Ktor 使うと思う

@yuuahp
Copy link
Member

yuuahp commented Oct 22, 2023

もしかして VisionAPI ってクレジットカード必須ですか?

@book000
Copy link
Member Author

book000 commented Oct 22, 2023

そうかも。

@yuuahp
Copy link
Member

yuuahp commented Oct 23, 2023

ダメです。

@book000
Copy link
Member Author

book000 commented Oct 23, 2023

うーん、ちょっと内々で話させてください

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants