Clear/Refresh gr.Gallery output on event on huggingface

Hi, i’ve been struggling trying to make reset after an event. The code i’m showing works fine locally, but on my space it doesn’t work as expected.
The app uses 2 models and creates output images from an image and text. After i run it once and then change the input image, run it again, the output gallery will display previous images. Been thinking that is possible that the files are not overwriting? But as i said, it works as expected locally (no previuos images displayed when rerun).
Some extra info: when rerun i’m not deleting any files. New images should overwrite/will have same name. I’ve allowed_files in my launch settings. None, outputs=output).then(make_gallery, [upload_img, text_input], [output])
    text_input.submit(lambda: None, outputs=output).then(make_gallery, [upload_img, text_input], [output])

Does anyone know how can i fix this issue happening in huggingface/spaces?


In case anyone encounters a similar issue, i’ve added an UUID to the folders the function was creating and problem “solved”.