When i use the SVD Stability.apiAPI there is an error shown to me which is like this in Django, the API i used is this https://platform.stability.ai/docs/api-reference#tag/Image-to-Video
this is my view.py
def img2vid(request): error = None video = None form = ImageForm() context = None if request.method == 'POST': form = ImageForm(request.POST, request.FILES) if form.is_valid(): form.save() realImage = request.FILES['Image'] imageName = str(form.cleaned_data['Image']) # check the extension of the image and return an error if its happen ext = pathlib.Path(imageName).suffix.replace(".", "") if (ext != "png" and ext != "jpeg" and ext != "jpg"): error = "Invalid Extension . PNG & JPEG are allowed only" return render(request, "img2vid.html", {'form': form, 'error': error}) imgloc = rf'media\images\\{imageName}' imgloc2 = imgloc.strip().replace(" ", "_") image = Image.open(imgloc2) imgSize = image.size w, h = image.size new_w, new_h = w, h greater = h if h < w: greater = w if 300 <= abs(w - h) <= 2000: new_w, new_h = 1024, 576 elif h > w: if 300 <= abs(w - h) <= 2000: new_w, new_h = 576, 1024 if 0 <= abs(w - h) <= 299: new_w, new_h = 768, 768 new_image = image.resize((new_w, new_h)) new_image.save(imgloc2) response = requests.post( f"https://api.stability.ai/v2beta/image-to-video", headers={"authorization": f"Bearer apitoken"}, files={"image": open(imgloc2, "rb")}, data={"seed": 0,"cfg_scale": 1.8,"motion_bucket_id": 127 }, ) apiId = response.json().get('id') print(response.content) print(apiId) count = 0 while True: response = requests.get( f"https://api.stability.ai/v2beta/generation/image-to-video/result/{apiId}", headers={'Accept': "application/json",'authorization': f"Bearer apitoken" }, ) print(response) if response.status_code == 202: print("Generation in-progress, try again in 10 seconds.") count = count+1 print(count) time.sleep(10) elif response.status_code == 200: print("Generation complete!") video = response.json()["video"] break else: raise Exception(str(response.json())) return render(request, "img2vid.html", {"video": video, "form": form})this is the terminal when its print the above
print(response.content)
print(apiId)
Can you please Explain what is the error and if there is any way that i can fix it?? Thanks.

