Spaces:
Running
on
Zero
python code not working
from gradio_client import Client, handle_file
Define the API endpoint and input file
client = Client("https://jeffreyxiang-trellis.hf.space")
file_path = "https://www.larousse.fr/encyclopedie/data/images/1002997-Lama.jpg"
try:
# Attempt to call the API
result = client.predict(
image=handle_file(file_path), # Input image file
multiimages=[], # Optional additional images
seed=0, # Random seed
ss_guidance_strength=7.5, # Guidance strength for single image
ss_sampling_steps=12, # Sampling steps for single image
slat_guidance_strength=3, # Guidance strength for slat
slat_sampling_steps=12, # Sampling steps for slat
multiimage_algo="stochastic", # Algorithm for multi-image processing
api_name="/image_to_3d" # API endpoint for the task
)
# Print the successful result
print("3D Asset Generation Result:", result)
except Exception as e:
# Log the error details
print("An error occurred during API interaction:")
print(e)
error :
nc@MacBookPro code-ressources % /usr/local/bin/python /Users/nc/code-ressources/scripts/3d/generate.py
Loaded as API: https://jeffreyxiang-trellis.hf.space/ ✔
An error occurred during API interaction:
The upstream Gradio app has raised an exception but has not enabled verbose error reporting. To enable, set show_error=True in launch().
I could work with API correctly but I have a big problem with multiimages.
When I put more pictures in the multiimages[] argument. Without getting an error, the work is done, but it only uses the same photo as given in the image argument, and it actually only works with a single photo. If it works with multiple photos through the site and how amazingly it optimizes the output 3D model. Thank you for helping me.
@JeffreyXiang
Thanks a lot
@mdgh68 In the demo gradio code, the is_multiimage gr.State control if the multi image mode is enabled. I hope this is helpful to you.
Hi again and thanks for your answer.
@JeffreyXiang
I used this API (like example) :
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)
when I fill 'image' or 'multiimages' both will use just 'image' address to creating 3d model. I guess for multi image mode 'api_name' may should be different or other parameters. can you help me?
use chatgpt to correct
@deeduckme
My dear friend, surely that's the first thing anyone would think of. Not only ChatGPT, but also Copilot and Deep Seek couldn't solve the issue, so I had to ask Professor
@JeffreyXiang
for help.
According to the Api guide, there should be no problem with the code, because it is written exactly like the example, and all the codes work correctly, except for multiimage in the video and 3d design stage. Even preprocess works in multiimage mode