Image URL should be accessible universally

#12
by PranavBhatt - opened
This comment has been hidden

This is actually a local path to the generated image. I am using this same code in Google Colab and I can display the resulting image using matplotlib

from matplotlib import pyplot as plt
import matplotlib.image as mpimg
from gradio_client import Client

...

print(result)

img = mpimg.imread(result)
imgplot = plt.imshow(img)
plt.show()

In case you are building an API using FastAPI, you can return the file using return FileResponse(result, media_type="image/jpeg") (I haven't tested it out personally)

PranavBhatt changed discussion status to closed

Thank you for your help! Really appreciate it!

Sign up or log in to comment