LeiaInc / leiapix-cloud-api-example

Samples of integration logic with LeiaPix Cloud API
https://cloud.leiapix.com
13 stars 5 forks source link

"errorCode":"ERROR_OUTPUT_URL_IS_NOT_WRITABLE" #2

Open glebmiller opened 1 year ago

glebmiller commented 1 year ago

Hello, I'm trying to use the API, but I don't use s3 bucket or other cloud storages, I've configured url presigning on my ec2 instance. making disparity images works great, the image is uploaded, no issue. I use the same function to make resigned urls for uploads, so I don't think that's the issue.

but I have an error when trying actual animation. can it be fixed? I'm writing here, because discord invite link has expired

# url example
# https://mysite.com/upload/cd300761-47c5-4594-ae2b-a6e74d5f3ef4/animation.mp4?expires=2023-09-07T14:41:39.933194 
def make_animation(animation_url: str):

    correlation_id = str(uuid.uuid4())

    response = requests.post(
        'https://api.leiapix.com/api/v1/animation',
        headers={
            'Authorization': f'Bearer {get_token()}'   
        },
        json={
            'correlationId': correlation_id,
            'inputImageUrl': 'https://mysite.com/image_1.png',  # Readable Link to the image you want to create animation for
            'inputDisparityUrl': 'https://mysite.com/disparity.png', # Readable Link to disparity. Either received using /disparity API call or your own disparity map
            'resultPresignedUrl': animation_url,  # Writeable (HTTP PUT) URL for output animation
            'phaseX': 0.5,
            'amplitudeX' : 1,
            'animationLength': 5
        },
        timeout= 5 * 600  # expires in 5 min
    )
    print(response.text)
Ronincod3 commented 8 months ago

may I recommend using your own server? Ngrok and Flask seems to be working great. just point the inputdisparityurl to it and accept POST and PUT, I hope that helps. Example:

from flask import Flask, request, send_from_directory
import os

app = Flask(__name__, static_folder='static')

@app.route('/', methods=['POST', 'PUT'])
def handle_post():
    image_data = request.data

    # Save the image data to a file in the static directory
    with open('static/received_image.png', 'wb') as f:
        f.write(image_data)

    return '', 200

@app.route('/static/<path:path>')
def send_image(path):
    return send_from_directory('static', path)

if __name__ == '__main__':
    app.run(port=5000)
zoompeng commented 8 months ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。