What I’m trying to do:
I have an application which implements the OpenAI API to integrate DALL-E 2 image generation. The generation works fine, and I have an image url from OpenAI which allows me to display the image on the anvil site.
https://dalle-test.anvil.app
My goal is to have another site, or another page on the same site (but running in a different tab) - that will AUTOMATICALLY refresh whenever a new image is generated (for example, either displaying the images in a grid, or on a repeating slideshow).
This ‘display tab’ will be constantly running on a projector, and the ‘generation’ will be constantly open on a laptop for people to come and add their own prompts.
What I’ve tried and what’s not working:
This may not be essential, as I may just be able to store the Image URL - but when I try to make a GET request for the image URL (example link)
I can succesfully render it in the browser but the python requests module receives an error:
"No 'Access-Control-Allow-Origin' header is present on the requested resource"
.
This is not directly related to the question above, which is more about automatic refresh, but it may be a blocker if I need to store these images as MediaObjects in an anvil table.
Clone link (for DALLE demonstration):
share a copy of your app
Any ideas on how I could automatically refresh a page every time something is added to a data table would be highly appreciated.
This could use custom javascript if needbe.
Thanks in advance!
Pat