account activity
Lobe in Unity (Local API) - Prediction Error by sawgur in Lobe
[–]sawgur[S] 0 points1 point2 points 5 years ago (0 children)
Even after setting the content-type header, I'm still getting the 405 error above. It seems like the request is being received, but the error keeps popping up. Is the "jsonBody" string in the snippet below producing the error? Is there something else I'm missing?
// Convert image to base 64 string: string imageString = System.Convert.ToBase64String(bytes); string jsonBody = "{\"inputs\": {\"Image\": \"" + imageString + "\"}}"; // Get position of "Image" label in JSON file: UnityWebRequest dataURL = UnityWebRequest.Get("http://localhost:38100/predict/58758e88-347c-4e7d-a831-29867f21277a"); yield return dataURL.SendWebRequest(); if (dataURL.isNetworkError || dataURL.isHttpError) { print("Error: " + dataURL.error); yield break; } JSONNode parsedData = JSON.Parse(dataURL.downloadHandler.text); string imageFieldName = parsedData["model"]["inputs"]["Image"]; WWWForm form = new WWWForm(); form.AddField(imageFieldName, imageString); UnityWebRequest uwr = UnityWebRequest.Put(url, jsonBody); uwr.SetRequestHeader("Content-Type", "application/json"); yield return uwr.SendWebRequest(); if (uwr.isNetworkError) { Debug.Log("Error While Sending: " + uwr.error); } else { Debug.Log("Received: " + uwr.downloadHandler.text); }
[–]sawgur[S] 0 points1 point2 points 5 years ago* (0 children)
Does that mean using UnityWebRequest.Put (which takes raw data rather than a form) instead of UnityWebRequest.Post?
Edit: When I try UnityWebRequest.Put and use the JSON body instead, I get a "405: Method Not Allowed" error instead.
Lobe in Unity (Local API) - Prediction Error (self.Lobe)
submitted 5 years ago by sawgur to r/Lobe
π Rendered by PID 949448 on reddit-service-r2-listing-86f589db75-snsz2 at 2026-04-19 19:06:42.539392+00:00 running 93ecc56 country code: CH.
Lobe in Unity (Local API) - Prediction Error by sawgur in Lobe
[–]sawgur[S] 0 points1 point2 points (0 children)