multi image not work by API

#47
by mdgh68 - opened

Hello Dear @JeffreyXiang ,

First and foremost, I would like to express my sincere gratitude for the outstanding 3D modeling solution you have provided. It truly is an exceptional and unparalleled tool.

However, I have encountered an issue with using the API for generating a 3D model. When I fill the 'image' or 'multiimages' fields, only the address provided in 'image' is used to create the 3D model. In other words, whether I provide multiple views in 'multiimages[]' or just a single view in 'image', the output 3D file remains the same. It seems to ignore the files given in the "multiimages[]" parameter despite no error occurring.

Could you kindly assist me in accessing all the features of the desired space using the API? Your expertise and guidance would be greatly appreciated.

Thank you very much for your help.
Best regards

API that I used(like example in "JeffreyXiang/TRELLIS" space provided) :

from gradio_client import Client, handle_file
client = Client("JeffreyXiang/TRELLIS")
result = client.predict(
image=handle_file('https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png'),
multiimages=[],
seed=0,
ss_guidance_strength=7.5,
ss_sampling_steps=12,
slat_guidance_strength=3,
slat_sampling_steps=12,
multiimage_algo="stochastic",
api_name="/image_to_3d"
)
print(result)

Same issue, tried absolutely everyhting, even hardcoding the values but no luck, did you manage to fix it ?

@arabago96
Unfortunately not yet. Please let me know if you find a way.

Hey bro so this is what i found so far, apparently there is an additional parameter not added in the api, if we look directly at the app code you can see this

@spaces.GPU
def image_to_3d(
image: Image.Image,
multiimages: List[Tuple[Image.Image, str]],
is_multiimage: bool, # This is used in their code
seed: int,
# ...
):
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
if not is_multiimage:
outputs = pipeline.run(
image,
seed=seed,
# ...
)
else:
outputs = pipeline.run_multi_image(
[image[0] for image in multiimages],
seed=seed,
# ...
)

meaning there should be a is_multiimage parameter which is true or false, in fact if you try to record your api session you will notice all parameters get moved one spot down, and leaving a null below multiimages array. additionally if you check the network request in the terminal, you see it expects 9 parameters.
Screenshot 2025-02-14 at 13.59.29.png

the only issue now is that even when i add it the api rejects it because the is_multiimage: bool, is not configured in the API of the space, maybe if we duplicate the space we can very easily make it available but i don't have ZERO to run it. im sure jeffrey could fix it in a mater of minutes but i don't know how to get in contact with him or tag him here.

@arabago96
Unfortunately not yet. Please let me know if you find a way.

Sign up or log in to comment