Adding model and prompt info to generated image

Hi,

I’m looking for a way to add the model name and prompt text as metadata to images generated with text2image models in a space demo (such as the one created with the code below), so that I can later retrieve that information from the images I’ve downloaded. So far, I haven’t been able to come up with anything, unfortunately.

import gradio as gr


current_models = ["digiplay/AbsoluteReality_v1.8.1", "dreamlike-art/dreamlike-photoreal-2.0"]
loaded_models = {m: gr.load(f'models/{m}') for m in models}


def generate(model, prompt):
    try:
        img = loaded_models[model](prompt)
        ## somehow add the model name and prompt text as metadata?
        return img
    except:
        return None

                 
with gr.Blocks() as demo:
    with gr.Column():
        model_choices = [gr.Textbox(m, visible = False) for m in current_models]
        input_prompt = gr.Textbox(label = 'Prompt:')
        run_btn = gr.Button('Generate', variant = 'primary')
        stop_btn = gr.Button('Stop')

    output_img = [gr.Image(label = m) for m in current_models]
 
    for m, o in zip(model_choices, output_img):
        gen_event = run_btn.click(generate, [m, input_prompt], o, queue = True)
        stop_btn.click(cancels = [gen_event], show_progress = False)

    
demo.queue().launch(debug = True)

Any help would be greatly appreciated.