{ "cells": [ { "cell_type": "code", "execution_count": 13, "id": "ccdc7909", "metadata": {}, "outputs": [], "source": [ "\n", "# ! pip install -r ../../../../requirements.txt -U" ] }, { "cell_type": "code", "execution_count": 14, "id": "25aece1d", "metadata": {}, "outputs": [], "source": [ "from agent_framework import Agent, Content\n", "from agent_framework.foundry import FoundryChatClient\n", "from azure.identity import AzureCliCredential" ] }, { "cell_type": "code", "execution_count": 15, "id": "4e54cdb7", "metadata": {}, "outputs": [], "source": [ "\n", "import os\n", "import base64\n", "from dotenv import load_dotenv\n" ] }, { "cell_type": "code", "execution_count": 16, "id": "6b0e6968", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "load_dotenv(\"../../../../.env\")" ] }, { "cell_type": "code", "execution_count": 17, "id": "5b560781", "metadata": {}, "outputs": [], "source": [ "AgentName = \"Vision-Agent\"\n", "AgentInstructions = \"You are my furniture sales consultant, you can find different furniture elements from the pictures and give me a purchase suggestion\"" ] }, { "cell_type": "code", "execution_count": 19, "id": "26ff8fae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "User: Please find the relevant furniture according to the image and give the corresponding price for each piece of furniture [Image provided]\n", "Agent: From the image, I can identify the main furniture and decor pieces and give you **estimated market prices** based on similar modern/minimalist items. Since I can’t confirm the exact brand from the photo alone, these are **reference purchase suggestions**.\n", "\n", "## Furniture identified from the image\n", "\n", "| Item | Description | Estimated Price |\n", "|---|---|---:|\n", "| **3-seat sofa** | White modern fabric sofa with square arms | **$700–$1,500** |\n", "| **Accent lounge chair** | Dark blue upholstered lounge/armchair | **$300–$900** |\n", "| **Coffee table** | Small oval/rounded white-top coffee table with wood legs | **$150–$450** |\n", "| **TV stand / media console** | Light wood low-profile TV cabinet | **$250–$700** |\n", "| **Side table** | Small black metal side table next to the sofa | **$60–$180** |\n", "| **Round pedestal side table** | Small round table near the blue chair | **$80–$250** |\n", "| **Main chandelier** | Modern black branched chandelier with globe bulbs | **$180–$600** |\n", "| **Pendant lights** | 2–3 glass globe pendant lights near the corner | **$50–$180 each** |\n", "| **Curtains (full set)** | Sheer white inner curtains + gray blackout drapes | **$200–$600** |\n", "| **Wall art** | Framed deer artwork | **$50–$200** |\n", "| **Decor pillows** | Assorted blue/black/white throw pillows | **$20–$50 each** |\n", "| **TV** | Flat-screen TV, approx. 55\"–65\" | **$400–$1,200** |\n", "\n", "## Estimated total budget\n", "\n", "Depending on quality level:\n", "\n", "- **Budget setup:** **$2,440–$4,500**\n", "- **Mid-range setup:** **$4,500–$7,500**\n", "- **Higher-end look:** **$7,500+**\n", "\n", "## Purchase suggestions by style\n", "To match this room, look for these keywords:\n", "\n", "- **Style:** Modern / Scandinavian / Minimalist\n", "- **Colors:** White, light oak, black, navy blue, gray\n", "- **Materials:** Fabric upholstery, light wood veneer, metal legs, glass globe lighting\n", "\n", "## Best priority purchases\n", "If you want to recreate the look efficiently, buy in this order:\n", "\n", "1. **White sofa**\n", "2. **Light wood TV stand**\n", "3. **Oval coffee table**\n", "4. **Blue accent chair**\n", "5. **Black chandelier**\n", "6. **Curtains**\n", "7. **Side tables + pillows + wall art**\n", "\n", "If you want, I can also turn this into a **shopping list with specific products and estimated prices from IKEA, Amazon, Wayfair, or local furniture stores**.\n" ] } ], "source": [ "# Create a Foundry-backed agent with vision capabilities\n", "agent = Agent(\n", " client=FoundryChatClient(credential=AzureCliCredential()),\n", " name=AgentName,\n", " instructions=AgentInstructions,\n", ")\n", "\n", "# Prepare image\n", "image_path = \"../../files/home.png\"\n", "with open(image_path, \"rb\") as image_file:\n", " image_b64 = base64.b64encode(image_file.read()).decode()\n", "image_uri = f\"data:image/png;base64,{image_b64}\"\n", "\n", "# Send text and image as separate content items\n", "print(\"User: Please find the relevant furniture according to the image and give the corresponding price for each piece of furniture [Image provided]\")\n", "first_result = await agent.run(\n", " [\n", " Content.from_text(text=\"Please find the relevant furniture according to the image and give the corresponding price for each piece of furniture\"),\n", " Content.from_uri(uri=image_uri, media_type=\"image/png\")\n", " ]\n", ")\n", "\n", "print(f\"Agent: {first_result.text}\")" ] } ], "metadata": { "kernelspec": { "display_name": "agentdev", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.10" } }, "nbformat": 4, "nbformat_minor": 5 }