import gradio as gr
from utils import get_hf_space_file_url_prefix
def WelcomeUI():
# Placeholder for initial UI Use the image as background with a dark overlay
return f"""
Welcome to Vibe Shopping
What the AI assistant want to show you will appear here.
You can talk to the AI assistant to find products, virtual try on clothes, check how products like furniture look in your home, and more.
You can also upload an image to show to the AI assistant what you are looking for or upload images of yourself to try on clothes.
"""
def ProductList(products: list[dict[str, str]]):
print("Rendering product list with", len(products), "products")
if not products:
return """
Empty products list. Try searching for something!
"""
cards = ""
for product in products:
name = product.get("name", "Unnamed Product")
price = product.get("price", "N/A")
image = product.get("image_url", "")
cards += f"""
"""
return f"""
{cards}
"""
def ImageDisplay(image_url: str):
if not image_url:
return ""
return f"""
{FullSizeImage(image_url)}
"""
def FullSizeImage(image_url, fit: str = "contain", border_radius=12) -> str:
return f"""
"""
def ColdBootUI():
return gr.HTML(
"""
Starting Inference Server on Modal...
If this happen to be a cold-boot, it may take up to 2 minutes. Please wait...
""",
)
def EndOfDemo():
return gr.HTML(
"""
The free demo period is over :(
If you still want to try it out, you can clone the repo and run it yourself.
If you need any help, feel free to ask in the community tab in the huggingface space.
""",
)