\n"
],
"text/plain": [
" product_name category tagline \\\n",
"10 Pulse Portable Charger Tech Compact Portable Charger \n",
"77 Pulse Portable Charger Tech Eco-Friendly Portable Charger \n",
"75 Bloom Portable Charger Tech Long-Lasting Portable Charger \n",
"\n",
" ad_copy target_audience \n",
"10 Meet Pulse portable charger, designed for stud... students \n",
"77 Meet Pulse portable charger, designed for youn... young professionals \n",
"75 Meet Bloom portable charger, designed for busy... busy parents "
]
},
"execution_count": 89,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from sentence_transformers import SentenceTransformer\n",
"\n",
"model = SentenceTransformer(\"sentence-transformers/all-MiniLM-L6-v2\")\n",
"\n",
"def search_by_text(query, k=3):\n",
" q_emb = model.encode([query], normalize_embeddings=True)\n",
" sims = cosine_similarity(q_emb, emb)[0]\n",
" top_idx = np.argsort(-sims)[:k]\n",
"\n",
" return meta.iloc[top_idx][\n",
" [\"product_name\",\"category\",\"tagline\",\"ad_copy\",\"target_audience\"]\n",
" ]\n",
"\n",
"search_by_text(\"portable charger for students\", k=3)"
]
},
{
"cell_type": "markdown",
"id": "3cfc154d",
"metadata": {
"id": "ewLbkKWLZynO"
},
"source": [
"The query-based retrieval returned relevant recommendations: the top results are portable chargers in the Tech category, and the first match also targets students, showing that the embedding-based similarity search works as intended."
]
},
{
"cell_type": "markdown",
"id": "de0a6939",
"metadata": {
"id": "ZGxkOOXKW-lw"
},
"source": [
"In this stage, we generated embeddings using three Hugging Face models: two text models (MiniLM, E5) and one image model (CLIP), all based on our Hugging Face dataset.\n",
"\n",
"The models were evaluated using a retrieval-based metric measuring Top-5 similarity by product category and target audience, along with runtime and embedding size.\n",
"\n",
"Based on a weighted comparison, MiniLM was selected as the final embedding model for the recommendation system."
]
},
{
"cell_type": "markdown",
"id": "7d611cdc",
"metadata": {
"id": "xoGKMtcO6TdN"
},
"source": [
"
\n",
"\n",
"---\n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"id": "9a969ca0",
"metadata": {
"id": "5JKjxJ7duKzN"
},
"source": [
"# Part 4: Input-Output Pipeline\n",
"\n",
"**USER INPUT --> PIPELINE --> AI OUTPUT**\n",
"\n",
"Build an IO pipeline - from user input to AI output:\n",
"\n",
"- Classification\n",
"- Prediction\n",
"- Recommendion\n",
"- Style transfer \n",
"etc.\n",
"\n",
"\n",
"For example, in the healthcare domain:\n",
"- User uploads a skin mole image, and gets the top 10 most similar skin moles in the dataset.\n",
"- User writes symptoms/disease description and gets the probability of the posibble disease.\n",
"- User uploads a sound of a Coughs and gets the probability of the conditions.\n",
"- User uploads a CT image and gets an MRI image in return.\n",
"- Doctor A writes a medical report and choose doctor B from a list, and gets the report in doctor B's style.\n"
]
},
{
"cell_type": "markdown",
"id": "bab93925",
"metadata": {
"id": "20mKc0zE1H5a"
},
"source": [
"Example of how an IO Recommendation Pipeline would work:"
]
},
{
"cell_type": "markdown",
"id": "d847faee",
"metadata": {
"id": "GEn2a0o9DeZT"
},
"source": [
""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67ddd653",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 248,
"referenced_widgets": [
"7e2250272800498fb4209796e509536b",
"21be431abbf5472193c3921be9992140",
"f5d312dc45b045f18a3e637dcac0c0ad",
"b94380b702e14ed2b4ed37328a062d1b",
"edc346f73661489ea4ef81fddd9c0b02",
"d884adb4b3ca45e5ae3297ff84bb11b7",
"3f4d12b241174214b3bb62b69faac7d7",
"f46539d6146e46ad9b74e9c3096261b4",
"907d5e49b93f4e4aaba99a03a02fef9d",
"7c1791394e21483fad8679123ffb002b",
"59c60f9d435540aaabb902a08eae99cc"
]
},
"id": "ecnHQRQZ2UgX",
"outputId": "6836b1d4-b2c6-482e-d4ed-f92f5625771f"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Repo card metadata block was not found. Setting CardData to empty.\n",
"WARNING:huggingface_hub.repocard:Repo card metadata block was not found. Setting CardData to empty.\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7e2250272800498fb4209796e509536b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Resolving data files: 0%| | 0/121 [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"HF dataset: Barvero/adautogen-multimodal\n",
"Rows: 120 | Emb shape: (120, 384)\n"
]
},
{
"data": {
"application/vnd.google.colaboratory.intrinsic+json": {
"summary": "{\n \"name\": \"meta\",\n \"rows\": 120,\n \"fields\": [\n {\n \"column\": \"id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 34,\n \"min\": 0,\n \"max\": 119,\n \"num_unique_values\": 120,\n \"samples\": [\n 44,\n 47,\n 4\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"product_name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 84,\n \"samples\": [\n \"Lumen Portable Charger\",\n \"Bloom Matcha Drink\",\n \"Pulse Face Cream Jar\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"category\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 6,\n \"samples\": [\n \"Food\",\n \"Fitness\",\n \"category: Home\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"tagline\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 86,\n \"samples\": [\n \"Long-Lasting Hair Serum Bottle\",\n \"Lightweight Matcha Drink\",\n \"Compact Gym Gloves\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ad_copy\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 118,\n \"samples\": [\n \"Meet Aero gym gloves, designed for fitness lovers.\",\n \"Meet Pulse smart watch, designed for young professionals.\",\n \"Meet Pulse cleanser bottle, designed for busy parents.\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"target_audience\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 6,\n \"samples\": [\n \"remote workers\",\n \"students\",\n \"Busy parents\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"image\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}",
"type": "dataframe",
"variable_name": "meta"
},
"text/html": [
"\n",
"
"
]
},
{
"cell_type": "markdown",
"id": "2b7bc3bf",
"metadata": {
"id": "p4Si5I7B8c_p"
},
"source": [
"\n",
"# Part 6: **Live Demo Presentation**\n",
"\n",
"* **Each student/pair will present their project live**\n",
"\n",
" * **20-minute session** per team\n",
"\n",
" * \\~10–12 minutes: Demo walkthrough\n",
" * \\~8–10 minutes: Q&A with the faculty\n",
"* Be prepared to present:\n",
"\n",
" * Your **modality and use case**\n",
" * The **dataset** and **models** you tested\n",
" * A live demo of your Hugging Face Space\n",
" * Clear explanation of how your AI pipeline/engine works\n",
"\n",
"* Expect technical and conceptual questions from the faculty about your work\n",
"* Expect Knowledge questions from the faculty about the main topics we covered during the course\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "1f2d4b82",
"metadata": {
"id": "f8xJVIis6Xt_"
},
"source": [
"