-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with OpenAI API and Whisper Webservice. #13
Merged
Conversation
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
Refs: - Studying of request bodies of the self-hosted server. - https://platform.openai.com/docs/guides/speech-to-text - https://zh.wikipedia.org/wiki/%E4%BA%92%E8%81%94%E7%BD%91%E5%AA%92%E4%BD%93%E7%B1%BB%E5%9E%8B (audio/mp4 not listed in the English page) - https://stackoverflow.com/questions/24279563/uploading-a-large-file-in-multipart-using-okhttp - https://blog.csdn.net/XuWei1213/article/details/79693340
… code configuration.
Ideally, both configuration handling and Datastore access should be refactored in the future.
Different form body and headers are required respectively. Ref: https://platform.openai.com/docs/guides/speech-to-text/quickstart
…i key. Since OpenAI API and Whisper Webservice have different request styles.
Original argument is wrong. Turns out 1 is desired to place the cursor at the end of the commited text. Ref: https://developer.android.com/reference/android/view/inputmethod/InputConnection#commitText(java.lang.CharSequence,%20int)
j3soon
approved these changes
Nov 26, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this PR. Just confirmed this works on a Pixel_3a_API_34_extension_level_7_x86_64
simulator.
Most of the comments are notes for myself. Only the comment on the formatting of <T>
may be useful to you.
android/app/src/main/java/com/example/whispertoinput/MainActivity.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/com/example/whispertoinput/WhisperTranscriber.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/java/com/example/whispertoinput/WhisperTranscriber.kt
Show resolved
Hide resolved
android/app/src/main/java/com/example/whispertoinput/WhisperTranscriber.kt
Show resolved
Hide resolved
android/app/src/main/java/com/example/whispertoinput/WhisperTranscriber.kt
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What This Branch Accomplished
Future Directions
Several possible refactoring, optimization, and improvements.
Testing This Branch
OpenAI API
Should work as before.
https://api.openai.com/v1/audio/transcriptions
zh
oren
OpenAI API
Self-hosted Whisper Webservice
docker run -d -p 9000:9000 -e ASR_MODEL=base -e ASR_ENGINE=openai_whisper onerahmet/openai-whisper-asr-webservice:latest
docker run -d --gpus all -p 9000:9000 -e ASR_MODEL=base -e ASR_ENGINE=openai_whisper onerahmet/openai-whisper-asr-webservice:latest-gpu
ASR_MODEL
arebase
,small
, ormedium
for locally hosted servers.onerahmet/openai-whisper-asr-webservice
has versionv1.2.0
.localhost:9000
and make one request using the web interface, as the container may not download necessary models before the first request is made and completed.http://<local-ip>:9000/asr
. Obtain local IP via methods likeipconfig
, which could look like192.168.xxx.xxx
. For hosted servers out there, use their URL endpoints.zh
oren
Closes: #3