# /app/components/ProductCard.py import gradio as gr from html import escape def render_product_card(p: dict) -> gr.HTML: """ Render a simple product dict with keys: id, name, description, price, currency, tags """ name = escape(str(p.get("name", ""))) desc = escape(str(p.get("description", ""))) price = p.get("price", "") currency = escape(str(p.get("currency", "USD"))) tags = p.get("tags") or [] tags_html = " ".join( f"{escape(str(t))}" for t in tags ) html = f"""
{name}
{price} {currency}
{desc}
{tags_html}
""" return gr.HTML(value=html)