-
Notifications
You must be signed in to change notification settings - Fork 143
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
Facing issue in ImageVariation call #83
Comments
Logs in organised way.
|
Hi @hassanmirza444, I think you are trying to upload a
PS: I've deleted your API key from the stacktraces above (and edit history) |
Yes brother, What I am doing is I select a file from gallery, and Logged it as 1. |
Can you share how did you convert it from |
@aallam Here is code, on Image selected from gallery and conversion to png ` override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
Correct me if I am wrong, in this code snippet you make a copy of the file with different extension, not actually converting it, right ? |
No , I am wrong. You are right. Issue was on my side. Now, it is fixed using below function. ` private fun convertJpgToPng(sourceuri: Uri): Uri {
|
I had integrate this library in my project. It is Working fine for content generation("v1/completions") and Image generation("v1/images/generations"). But When I start using ImageVariation ("v1/images/variations"), I had faced issue that I am unable to fix,
D 1-->file:///storage/emulated/0/DCIM/Camera/IMG_20230125_180236381.jpg 2023-01-25 18:02:38.499 8356-8356 hssn com.sparklab.ai D 2-->file:///data/user/0/com.sparklab.ai/files/sparklab/sparklab_hssnmirza.png 2023-01-25 18:02:38.975 8356-8396 OpenGLRenderer com.sparklab.ai D endAllActiveAnimators on 0xb4000076461a44d0 (RippleDrawable) with handle 0xb400007556108220 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I HttpClient: REQUEST: https://api.openai.com/v1/images/variations 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I METHOD: HttpMethod(value=POST) 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I COMMON HEADERS 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I -> Accept: application/json 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I -> Accept-Charset: UTF-8 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I -> Authorization: Bearer <apiKey> 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I CONTENT HEADERS 2023-01-25 18:02:40.404 8356-8583 System.out com.sparklab.ai I -> Content-Type: multipart/form-data; boundary=-651c0b63-3b3247d1-5ce2608bf515725-441b30e6-4507d4a361a52508-1fc4734e- 2023-01-25 18:02:40.535 8356-8585 TrafficStats com.sparklab.ai D tagSocket(96) with statsTag=0xffffffff, statsUid=-1 2023-01-25 18:02:42.753 8356-8585 System.out com.sparklab.ai I HttpClient: RESPONSE: 400 BAD REQUEST 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I METHOD: HttpMethod(value=POST) 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I FROM: https://api.openai.com/v1/images/variations 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I COMMON HEADERS 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> access-control-allow-origin: * 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> connection: keep-alive 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> content-length: 161 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> content-type: application/json 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> date: Wed, 25 Jan 2023 13:02:40 GMT 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> openai-organization: user-zinuwdnhn5tnrbfqaxqlrm8u 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> openai-processing-ms: 147 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> openai-version: 2020-10-01 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> strict-transport-security: max-age=15724800; includeSubDomains 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> x-android-received-millis: 1674651762739 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> x-android-response-source: NETWORK 400 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> x-android-selected-protocol: http/1.1 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> x-android-sent-millis: 1674651761388 --------- beginning of crash 2023-01-25 18:02:42.754 8356-8585 System.out com.sparklab.ai I -> x-request-id: 8ba8f7abb134b74cd3ae5b2d6f41c489 2023-01-25 18:02:42.798 8356-8592 AndroidRuntime com.sparklab.ai E FATAL EXCEPTION: DefaultDispatcher-worker-8 Process: com.sparklab.ai, PID: 8356 com.aallam.openai.api.exception.OpenAIHttpException at com.aallam.openai.client.internal.http.HttpTransport.perform(HttpTransport.kt:24) at com.aallam.openai.client.internal.http.HttpTransport$perform$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@9c8cf2c, Dispatchers.Default] Caused by: com.aallam.openai.api.exception.OpenAIAPIException: (statusCode=400, body='{ "error": { "code": null, "message": "Uploaded image must be a PNG and less than 4 MB.", "param": null, "type": "invalid_request_error" } } ') at com.aallam.openai.client.internal.http.HttpTransport.bodyOrThrow(HttpTransport.kt:32) at com.aallam.openai.client.internal.http.HttpTransport.perform(HttpTransport.kt:22) ... 9 more 2023-01-25 18:02:42.832 8356-8592 Process com.sparklab.ai I Sending signal. PID: 8356 SIG: 9
My Image is already in .png format and size is in KBs. So, Please let me know how can I fix it.
The text was updated successfully, but these errors were encountered: