import os, html, json import gradio as gr from jinja2 import Environment, FileSystemLoader from utils import read_file, get_models_data, get_contacts, img_b64, opis_to_html BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ASSETS_DIR = os.path.join(BASE_DIR, "assets") env = Environment(loader=FileSystemLoader(ASSETS_DIR), autoescape=True) SHOWCASE_EXTRA_CSS = """ footer, footer *, .footer, div[class*="footer"], .built-with, [class*="built-with"], [class*="ApiLink"], [class*="api-link"], .show-api, a[href*="gradio.app"], a[href*="huggingface"], button[title*="API"], button[title*="Setting"], button[aria-label*="Setting"], .top-panel, div.top-panel, [class*="top-panel"] { display: none !important; visibility: hidden !important; height: 0 !important; overflow: hidden !important; } .gradio-container { min-height: unset !important; } """ HIDE_FOOTER_JS = """ () => { const kill = () => { document.querySelectorAll('footer, .footer, [class*="footer"]').forEach(el => el.remove()); document.querySelectorAll('.show-api, [class*="ApiLink"], [class*="api-link"]').forEach(el => el.remove()); document.querySelectorAll('button[title*="Setting"], button[aria-label*="Setting"]').forEach(el => el.remove()); document.querySelectorAll('a[href*="gradio.app"]').forEach(el => { let p = el.closest('div'); if(p) p.remove(); }); }; kill(); setTimeout(kill, 300); setTimeout(kill, 1000); new MutationObserver(kill).observe(document.body, {childList:true, subtree:true}); } """ def build_gallery(images): if not images: return '