Discussions
Problems in disparity requests
Hello,
I use your API via a Streamlit UI that I developed. I generate presigned URLs via Google, and I have been using your API frequently. Recently, I noticed changes in your documentation, and I encountered errors in disparity and animation requests. Therefore, I tried updating the request URLs to match those in the new documentation.
I can successfully generate tokens using the following function:
# Função para obter o token de acesso LeiaPix
def get_access_token():
IMMERSITYAI_LOGIN_OPENID_TOKEN_URL = (
"https://auth.immersity.ai/auth/realms/immersity/protocol/openid-connect/token"
)
token_response = requests.post(
IMMERSITYAI_LOGIN_OPENID_TOKEN_URL,
data={
"client_id": YOUR_CLIENT_ID,
"client_secret": YOUR_CLIENT_SECRET,
"grant_type": "client_credentials",
},
).json()
st.write(token_response)
return token_response.get("access_token")
Unfortunately, when I try to generate disparity, I always get a timeout. I execute it as follows:
access_token = get_access_token()
if access_token:
# Gera URLs pré-assinadas para disparidade e animação
correlation_id_disparity = str(uuid.uuid4())
disparity_blob_name = f"disparity_{correlation_id_disparity}.jpg"
put_disparity_presigned_url = create_presigned_url_put(disparity_blob_name)
print(f"Google Disparity URL: {put_disparity_presigned_url}")
# Faz a chamada para a API da LeiaPix para disparidade
disparity_response = requests.post(
"https://api.immersity.ai/api/v1/disparity",
headers={
"accept": "application/json",
"content-type": "application/json",
"Authorization": f"Bearer {access_token}"
}, # Acquired in previous step
json={
"correlationId": correlation_id_disparity,
"inputImageUrl": image_url, # Link to the image you want to get disparity for
"resultPresignedUrl": put_disparity_presigned_url, # Presigned URL with HTTP PUT permission.
},
timeout=5*60, # expires in 5 min
)
print(disparity_response.status_code, disparity_response.text)
I am trying to understand what I might be doing wrong. As I mentioned, it used to work perfectly in Leia. I also tried making a request via your documentation page (https://docs-api.immersity.ai/reference/transactioncontroller_estimatemonodepth-1), but I receive a 500 error with the request structured as follows:
import requests
url = "https://api.immersity.ai/api/v1/disparity"
payload = { "inputImageUrl": "https://super.abril.com.br/wp-content/uploads/2018/05/filhotes-de-cachorro-alcanc3a7am-o-c3a1pice-de-fofura-com-8-semanas1.png?quality=70&strip=all&resize=420" }
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJVbDlpOTVQaVdhVXlsYmdQQVdZcERyS0NibWZhbUt3NnJWMk5jdWlwX09FIn0"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
Response:
{
"statusCode": 500,
"message": "Internal server error"
}
Could you please help me identify what might be causing these issues?
Thank you.