from pathlib import Path import gradio as gr from modules.html_generator import image_to_base64 def generate_html(): css = """ .character-gallery table { border-collapse: collapse; table-layout: fixed; width: 100%; } .character-gallery th, .character-gallery td { padding: 8px; } .character-gallery img { width: 150px; height: 200px; object-fit: cover; } .character-gallery .placeholder { width: 150px; height: 200px; background-color: gray; } .character-gallery .image-td { width: 150px; } .character-gallery .character-td { text-align: center !important; } """ table_html = f'" return table_html def ui(): with gr.Accordion("Character gallery"): update = gr.Button("Refresh") gallery = gr.HTML(value=generate_html()) update.click(generate_html, [], gallery)