Accesing images by api

#19
by helloonbelai - opened

Hi!
I've cloned the space and was trying to use it by api, this works but I don't know how to access the generated images

result = client.predict(
"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png", # str (filepath or URL to image) in 'parameter_7' Image component
"Howdy!", # str in 'Prompt' Textbox component
"Howdy!", # str in 'Additional prompt' Textbox component
"Howdy!", # str in 'Negative prompt' Textbox component
1, # int | float (numeric value between 1 and 4) in 'Number of images' Slider component
256, # int | float (numeric value between 256 and 512) in 'Image resolution' Slider component
1, # int | float (numeric value between 1 and 100) in 'Number of steps' Slider component
0.1, # int | float (numeric value between 0.1 and 30.0) in 'Guidance scale' Slider component
0, # int | float (numeric value between 0 and 1000000) in 'Seed' Slider component
1, # int | float (numeric value between 1 and 255) in 'Canny low threshold' Slider component
1, # int | float (numeric value between 1 and 255) in 'Canny high threshold' Slider component
api_name="/canny"
)
print(result)

After running this code , it returns something like "/tmp/gradio/c99171c1-2e19-4ad4-8e91-156572bac6ff"

Which I am unable to get by python.

Curious enough is that if I use the web gradio I can get the generated image by right clicking on it as: https://helloonbelai-controlnet-v1-1.hf.space/file=/tmp/gradio/33bcf09c6d0a20069cb70ea77e6161822773b72b/image.png

I tried replacing the path generated by python on the url and still I am not able to get into the image

The browser will return something like {"detail":"File not found: /tmp/gradio/c99171c1-2e19-4ad4-8e91-156572bac6ff/image.png."}

Any hints?

Sign up or log in to comment