From ad12ee99e94a3270c4e6f6f086feaf6fd849998c Mon Sep 17 00:00:00 2001 From: Bharat Puri Date: Mon, 20 Oct 2025 12:37:19 +0530 Subject: [PATCH] Added code enhancement and project assignment for week1 --- .../brochure_plus_translator.ipynb | 1849 +++++++++++++++++ .../bharat_puri/my_ai_tutor.ipynb | 231 ++ 2 files changed, 2080 insertions(+) create mode 100644 week1/community-contributions/bharat_puri/brochure_plus_translator.ipynb create mode 100644 week1/community-contributions/bharat_puri/my_ai_tutor.ipynb diff --git a/week1/community-contributions/bharat_puri/brochure_plus_translator.ipynb b/week1/community-contributions/bharat_puri/brochure_plus_translator.ipynb new file mode 100644 index 0000000..3f4e36d --- /dev/null +++ b/week1/community-contributions/bharat_puri/brochure_plus_translator.ipynb @@ -0,0 +1,1849 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "67159c63-c229-485c-8044-b506c1e17caa", + "metadata": {}, + "source": [ + "# A full business solution - – Enhanced Version\n", + "\n", + "\n", + "## Now we will take our project from Day 1 to the next level\n", + "\n", + "### BUSINESS CHALLENGE:\n", + "\n", + "Create a product that builds a Brochure for a company to be used for prospective clients, investors and potential recruits.\n", + "\n", + "We will be provided a company name and their primary website.\n", + "\n", + "See the end of this notebook for examples of real-world business applications.\n", + "\n", + "And remember: I'm always available if you have problems or ideas! Please do reach out.\n", + "\n", + "### Bharat Puri - Integrated translator feature on the existing brocher creation process" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "d5b08506-dc8b-4443-9201-5f1848161363", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "# If these fail, please check you're running from an 'activated' environment with (llms) in the command prompt\n", + "\n", + "import os\n", + "import json\n", + "from dotenv import load_dotenv\n", + "from IPython.display import Markdown, display, update_display\n", + "# To handle path of scraper go up 2 directories\n", + "import sys\n", + "sys.path.append(os.path.abspath(os.path.join(\"..\", \"..\"))) \n", + "from scraper import fetch_website_links, fetch_website_contents\n", + "from openai import OpenAI" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "fc5d8880-f2ee-4c06-af16-ecbc0262af61", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "API key looks good so far\n" + ] + } + ], + "source": [ + "# Initialize and constants\n", + "\n", + "load_dotenv(override=True)\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "\n", + "if api_key and api_key.startswith('sk-proj-') and len(api_key)>10:\n", + " print(\"API key looks good so far\")\n", + "else:\n", + " print(\"There might be a problem with your API key? Please visit the troubleshooting notebook!\")\n", + " \n", + "MODEL = 'gpt-5-nano'\n", + "\n", + "openai = OpenAI()" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "e30d8128-933b-44cc-81c8-ab4c9d86589a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['https://edwarddonner.com/',\n", + " 'https://edwarddonner.com/connect-four/',\n", + " 'https://edwarddonner.com/outsmart/',\n", + " 'https://edwarddonner.com/about-me-and-about-nebula/',\n", + " 'https://edwarddonner.com/posts/',\n", + " 'https://edwarddonner.com/',\n", + " 'https://news.ycombinator.com',\n", + " 'https://nebula.io/?utm_source=ed&utm_medium=referral',\n", + " 'https://www.prnewswire.com/news-releases/wynden-stark-group-acquires-nyc-venture-backed-tech-startup-untapt-301269512.html',\n", + " 'https://patents.google.com/patent/US20210049536A1/',\n", + " 'https://www.linkedin.com/in/eddonner/',\n", + " 'https://edwarddonner.com/2025/09/15/ai-in-production-gen-ai-and-agentic-ai-on-aws-at-scale/',\n", + " 'https://edwarddonner.com/2025/09/15/ai-in-production-gen-ai-and-agentic-ai-on-aws-at-scale/',\n", + " 'https://edwarddonner.com/2025/05/28/connecting-my-courses-become-an-llm-expert-and-leader/',\n", + " 'https://edwarddonner.com/2025/05/28/connecting-my-courses-become-an-llm-expert-and-leader/',\n", + " 'https://edwarddonner.com/2025/05/18/2025-ai-executive-briefing/',\n", + " 'https://edwarddonner.com/2025/05/18/2025-ai-executive-briefing/',\n", + " 'https://edwarddonner.com/2025/04/21/the-complete-agentic-ai-engineering-course/',\n", + " 'https://edwarddonner.com/2025/04/21/the-complete-agentic-ai-engineering-course/',\n", + " 'https://edwarddonner.com/',\n", + " 'https://edwarddonner.com/connect-four/',\n", + " 'https://edwarddonner.com/outsmart/',\n", + " 'https://edwarddonner.com/about-me-and-about-nebula/',\n", + " 'https://edwarddonner.com/posts/',\n", + " 'mailto:hello@mygroovydomain.com',\n", + " 'https://www.linkedin.com/in/eddonner/',\n", + " 'https://twitter.com/edwarddonner',\n", + " 'https://www.facebook.com/edward.donner.52']" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "links = fetch_website_links(\"https://edwarddonner.com\")\n", + "links" + ] + }, + { + "cell_type": "markdown", + "id": "1771af9c-717a-4fca-bbbe-8a95893312c3", + "metadata": {}, + "source": [ + "## First step: Have GPT-5-nano figure out which links are relevant\n", + "\n", + "### Use a call to gpt-5-nano to read the links on a webpage, and respond in structured JSON. \n", + "It should decide which links are relevant, and replace relative links such as \"/about\" with \"https://company.com/about\". \n", + "We will use \"one shot prompting\" in which we provide an example of how it should respond in the prompt.\n", + "\n", + "This is an excellent use case for an LLM, because it requires nuanced understanding. Imagine trying to code this without LLMs by parsing and analyzing the webpage - it would be very hard!\n", + "\n", + "Sidenote: there is a more advanced technique called \"Structured Outputs\" in which we require the model to respond according to a spec. We cover this technique in Week 8 during our autonomous Agentic AI project." + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "6957b079-0d96-45f7-a26a-3487510e9b35", + "metadata": {}, + "outputs": [], + "source": [ + "link_system_prompt = \"\"\"\n", + "You are provided with a list of links found on a webpage.\n", + "You are able to decide which of the links would be most relevant to include in a brochure about the company,\n", + "such as links to an About page, or a Company page, or Careers/Jobs pages.\n", + "You should respond in JSON as in this example:\n", + "\n", + "{\n", + " \"links\": [\n", + " {\"type\": \"about page\", \"url\": \"https://full.url/goes/here/about\"},\n", + " {\"type\": \"careers page\", \"url\": \"https://another.full.url/careers\"}\n", + " ]\n", + "}\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "8e1f601b-2eaf-499d-b6b8-c99050c9d6b3", + "metadata": {}, + "outputs": [], + "source": [ + "def get_links_user_prompt(url):\n", + " user_prompt = f\"\"\"\n", + "Here is the list of links on the website {url} -\n", + "Please decide which of these are relevant web links for a brochure about the company, \n", + "respond with the full https URL in JSON format.\n", + "Do not include Terms of Service, Privacy, email links.\n", + "\n", + "Links (some might be relative links):\n", + "\n", + "\"\"\"\n", + " links = fetch_website_links(url)\n", + " user_prompt += \"\\n\".join(links)\n", + " return user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "6bcbfa78-6395-4685-b92c-22d592050fd7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Here is the list of links on the website https://edwarddonner.com -\n", + "Please decide which of these are relevant web links for a brochure about the company, \n", + "respond with the full https URL in JSON format.\n", + "Do not include Terms of Service, Privacy, email links.\n", + "\n", + "Links (some might be relative links):\n", + "\n", + "https://edwarddonner.com/\n", + "https://edwarddonner.com/connect-four/\n", + "https://edwarddonner.com/outsmart/\n", + "https://edwarddonner.com/about-me-and-about-nebula/\n", + "https://edwarddonner.com/posts/\n", + "https://edwarddonner.com/\n", + "https://news.ycombinator.com\n", + "https://nebula.io/?utm_source=ed&utm_medium=referral\n", + "https://www.prnewswire.com/news-releases/wynden-stark-group-acquires-nyc-venture-backed-tech-startup-untapt-301269512.html\n", + "https://patents.google.com/patent/US20210049536A1/\n", + "https://www.linkedin.com/in/eddonner/\n", + "https://edwarddonner.com/2025/09/15/ai-in-production-gen-ai-and-agentic-ai-on-aws-at-scale/\n", + "https://edwarddonner.com/2025/09/15/ai-in-production-gen-ai-and-agentic-ai-on-aws-at-scale/\n", + "https://edwarddonner.com/2025/05/28/connecting-my-courses-become-an-llm-expert-and-leader/\n", + "https://edwarddonner.com/2025/05/28/connecting-my-courses-become-an-llm-expert-and-leader/\n", + "https://edwarddonner.com/2025/05/18/2025-ai-executive-briefing/\n", + "https://edwarddonner.com/2025/05/18/2025-ai-executive-briefing/\n", + "https://edwarddonner.com/2025/04/21/the-complete-agentic-ai-engineering-course/\n", + "https://edwarddonner.com/2025/04/21/the-complete-agentic-ai-engineering-course/\n", + "https://edwarddonner.com/\n", + "https://edwarddonner.com/connect-four/\n", + "https://edwarddonner.com/outsmart/\n", + "https://edwarddonner.com/about-me-and-about-nebula/\n", + "https://edwarddonner.com/posts/\n", + "mailto:hello@mygroovydomain.com\n", + "https://www.linkedin.com/in/eddonner/\n", + "https://twitter.com/edwarddonner\n", + "https://www.facebook.com/edward.donner.52\n" + ] + } + ], + "source": [ + "print(get_links_user_prompt(\"https://edwarddonner.com\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "effeb95f", + "metadata": {}, + "outputs": [], + "source": [ + "def select_relevant_links(url):\n", + " response = openai.chat.completions.create(\n", + " model=MODEL,\n", + " messages=[\n", + " {\"role\": \"system\", \"content\": link_system_prompt},\n", + " {\"role\": \"user\", \"content\": get_links_user_prompt(url)}\n", + " ],\n", + " response_format={\"type\": \"json_object\"}\n", + " )\n", + " result = response.choices[0].message.content\n", + " links = json.loads(result)\n", + " return links\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "490de841", + "metadata": {}, + "source": [] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "2d5b1ded", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'links': [{'type': 'home page', 'url': 'https://edwarddonner.com/'},\n", + " {'type': 'about page',\n", + " 'url': 'https://edwarddonner.com/about-me-and-about-nebula/'},\n", + " {'type': 'product page', 'url': 'https://edwarddonner.com/connect-four/'},\n", + " {'type': 'product page', 'url': 'https://edwarddonner.com/outsmart/'},\n", + " {'type': 'course page',\n", + " 'url': 'https://edwarddonner.com/2025/04/21/the-complete-agentic-ai-engineering-course/'},\n", + " {'type': 'linkedin page', 'url': 'https://www.linkedin.com/in/eddonner/'},\n", + " {'type': 'twitter page', 'url': 'https://twitter.com/edwarddonner'},\n", + " {'type': 'facebook page',\n", + " 'url': 'https://www.facebook.com/edward.donner.52'}]}" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "select_relevant_links(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e7b84c0", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26709d38", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "a29aca19-ca13-471c-a4b4-5abbfa813f69", + "metadata": {}, + "outputs": [], + "source": [ + "def select_relevant_links(url):\n", + " print(f\"Selecting relevant links for {url} by calling {MODEL}\")\n", + " response = openai.chat.completions.create(\n", + " model=MODEL,\n", + " messages=[\n", + " {\"role\": \"system\", \"content\": link_system_prompt},\n", + " {\"role\": \"user\", \"content\": get_links_user_prompt(url)}\n", + " ],\n", + " response_format={\"type\": \"json_object\"}\n", + " )\n", + " result = response.choices[0].message.content\n", + " links = json.loads(result)\n", + " print(f\"Found {len(links['links'])} relevant links\")\n", + " return links" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "74a827a0-2782-4ae5-b210-4a242a8b4cc2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selecting relevant links for https://edwarddonner.com by calling gpt-5-nano\n", + "Found 6 relevant links\n" + ] + }, + { + "data": { + "text/plain": [ + "{'links': [{'type': 'home page', 'url': 'https://edwarddonner.com/'},\n", + " {'type': 'about page',\n", + " 'url': 'https://edwarddonner.com/about-me-and-about-nebula/'},\n", + " {'type': 'blog / insights', 'url': 'https://edwarddonner.com/posts/'},\n", + " {'type': 'linkedin', 'url': 'https://www.linkedin.com/in/eddonner/'},\n", + " {'type': 'twitter', 'url': 'https://twitter.com/edwarddonner'},\n", + " {'type': 'facebook', 'url': 'https://www.facebook.com/edward.donner.52'}]}" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "select_relevant_links(\"https://edwarddonner.com\")" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "d3d583e2-dcc4-40cc-9b28-1e8dbf402924", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selecting relevant links for https://huggingface.co by calling gpt-5-nano\n", + "Found 3 relevant links\n" + ] + }, + { + "data": { + "text/plain": [ + "{'links': [{'type': 'brand page', 'url': 'https://huggingface.co/brand'},\n", + " {'type': 'careers page', 'url': 'https://apply.workable.com/huggingface/'},\n", + " {'type': 'company page',\n", + " 'url': 'https://www.linkedin.com/company/huggingface/'}]}" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "select_relevant_links(\"https://huggingface.co\")" + ] + }, + { + "cell_type": "markdown", + "id": "0d74128e-dfb6-47ec-9549-288b621c838c", + "metadata": {}, + "source": [ + "## Second step: make the brochure!\n", + "\n", + "Assemble all the details into another prompt to GPT-5-nano" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "85a5b6e2-e7ef-44a9-bc7f-59ede71037b5", + "metadata": {}, + "outputs": [], + "source": [ + "def fetch_page_and_all_relevant_links(url):\n", + " contents = fetch_website_contents(url)\n", + " relevant_links = select_relevant_links(url)\n", + " result = f\"## Landing Page:\\n\\n{contents}\\n## Relevant Links:\\n\"\n", + " for link in relevant_links['links']:\n", + " result += f\"\\n\\n### Link: {link['type']}\\n\"\n", + " result += fetch_website_contents(link[\"url\"])\n", + " return result" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "5099bd14-076d-4745-baf3-dac08d8e5ab2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selecting relevant links for https://huggingface.co by calling gpt-5-nano\n", + "Found 7 relevant links\n", + "## Landing Page:\n", + "\n", + "Hugging Face – The AI community building the future.\n", + "\n", + "Hugging Face\n", + "Models\n", + "Datasets\n", + "Spaces\n", + "Community\n", + "Docs\n", + "Enterprise\n", + "Pricing\n", + "Log In\n", + "Sign Up\n", + "NEW\n", + "Try HuggingChat Omni – Chat with AI 💬\n", + "Get started with Inference in seconds 🚀\n", + "Reachy Mini: The Open Robot for AI Builders\n", + "The AI community building the future.\n", + "The platform where the machine learning community collaborates on models, datasets, and applications.\n", + "Explore AI Apps\n", + "or\n", + "Browse 1M+ models\n", + "Trending on\n", + "this week\n", + "Models\n", + "PaddlePaddle/PaddleOCR-VL\n", + "Updated\n", + "1 day ago\n", + "•\n", + "3.82k\n", + "•\n", + "609\n", + "nanonets/Nanonets-OCR2-3B\n", + "Updated\n", + "3 days ago\n", + "•\n", + "12.8k\n", + "•\n", + "316\n", + "Qwen/Qwen3-VL-8B-Instruct\n", + "Updated\n", + "4 days ago\n", + "•\n", + "74.5k\n", + "•\n", + "186\n", + "Phr00t/Qwen-Image-Edit-Rapid-AIO\n", + "Updated\n", + "about 16 hours ago\n", + "•\n", + "349\n", + "inclusionAI/Ling-1T\n", + "Updated\n", + "5 days ago\n", + "•\n", + "3k\n", + "•\n", + "450\n", + "Browse 1M+ models\n", + "Spaces\n", + "Building\n", + "294\n", + "294\n", + "veo3.1-fast\n", + "🐨\n", + "Generate videos from text or images\n", + "Running\n", + "15.2k\n", + "15.2k\n", + "DeepSite v3\n", + "🐳\n", + "Generate any application by Vibe Coding\n", + "Running\n", + "325\n", + "325\n", + "Sora 2\n", + "📉\n", + "Generate videos from text or images\n", + "Running\n", + "1.92k\n", + "1.92k\n", + "Wan2.2 Animate\n", + "👁\n", + "Wan2.2 Animate\n", + "Running\n", + "on\n", + "Zero\n", + "MCP\n", + "1.8k\n", + "1.8k\n", + "Wan2.2 14B Fast\n", + "🎥\n", + "generate a video from an image with a text prompt\n", + "Browse 400k+ applications\n", + "Datasets\n", + "karpathy/fineweb-edu-100b-shuffle\n", + "Updated\n", + "24 days ago\n", + "•\n", + "19.5k\n", + "•\n", + "55\n", + "Salesforce/Webscale-RL\n", + "Updated\n", + "6 days ago\n", + "•\n", + "6.91k\n", + "•\n", + "70\n", + "fka/awesome-chatgpt-prompts\n", + "Updated\n", + "Jan 6\n", + "•\n", + "37.3k\n", + "•\n", + "9.27k\n", + "Agent-Ark/Toucan-1.5M\n", + "Updated\n", + "16 days ago\n", + "•\n", + "10.9k\n", + "•\n", + "135\n", + "nick007x/github-code-2025\n", + "Updated\n", + "4 days ago\n", + "•\n", + "6.19k\n", + "•\n", + "27\n", + "Browse 250k+ datasets\n", + "The Home of Machine Learning\n", + "Create, discover and collaborate on ML better.\n", + "The collaboration platform\n", + "Host and collaborate on unlimited public models, datasets and applications.\n", + "Move faster\n", + "With the HF Open source stack.\n", + "Explore all modalities\n", + "Text, image, video, audio or even 3D.\n", + "Build your portfolio\n", + "Share your work with the world and build your ML profile.\n", + "Sign Up\n", + "Accelerate your ML\n", + "We provide paid Compute and Enterprise solutions.\n", + "Team & Enterprise\n", + "Give your team the most advanced platform to build A\n", + "## Relevant Links:\n", + "\n", + "\n", + "### Link: company page\n", + "Hugging Face – The AI community building the future.\n", + "\n", + "Hugging Face\n", + "Models\n", + "Datasets\n", + "Spaces\n", + "Community\n", + "Docs\n", + "Enterprise\n", + "Pricing\n", + "Log In\n", + "Sign Up\n", + "NEW\n", + "Try HuggingChat Omni – Chat with AI 💬\n", + "Get started with Inference in seconds 🚀\n", + "Reachy Mini: The Open Robot for AI Builders\n", + "The AI community building the future.\n", + "The platform where the machine learning community collaborates on models, datasets, and applications.\n", + "Explore AI Apps\n", + "or\n", + "Browse 1M+ models\n", + "Trending on\n", + "this week\n", + "Models\n", + "PaddlePaddle/PaddleOCR-VL\n", + "Updated\n", + "1 day ago\n", + "•\n", + "3.82k\n", + "•\n", + "609\n", + "nanonets/Nanonets-OCR2-3B\n", + "Updated\n", + "3 days ago\n", + "•\n", + "12.8k\n", + "•\n", + "316\n", + "Qwen/Qwen3-VL-8B-Instruct\n", + "Updated\n", + "4 days ago\n", + "•\n", + "74.5k\n", + "•\n", + "186\n", + "Phr00t/Qwen-Image-Edit-Rapid-AIO\n", + "Updated\n", + "about 16 hours ago\n", + "•\n", + "349\n", + "inclusionAI/Ling-1T\n", + "Updated\n", + "5 days ago\n", + "•\n", + "3k\n", + "•\n", + "450\n", + "Browse 1M+ models\n", + "Spaces\n", + "Building\n", + "294\n", + "294\n", + "veo3.1-fast\n", + "🐨\n", + "Generate videos from text or images\n", + "Running\n", + "15.2k\n", + "15.2k\n", + "DeepSite v3\n", + "🐳\n", + "Generate any application by Vibe Coding\n", + "Running\n", + "325\n", + "325\n", + "Sora 2\n", + "📉\n", + "Generate videos from text or images\n", + "Running\n", + "1.92k\n", + "1.92k\n", + "Wan2.2 Animate\n", + "👁\n", + "Wan2.2 Animate\n", + "Running\n", + "on\n", + "Zero\n", + "MCP\n", + "1.8k\n", + "1.8k\n", + "Wan2.2 14B Fast\n", + "🎥\n", + "generate a video from an image with a text prompt\n", + "Browse 400k+ applications\n", + "Datasets\n", + "karpathy/fineweb-edu-100b-shuffle\n", + "Updated\n", + "24 days ago\n", + "•\n", + "19.5k\n", + "•\n", + "55\n", + "Salesforce/Webscale-RL\n", + "Updated\n", + "6 days ago\n", + "•\n", + "6.91k\n", + "•\n", + "70\n", + "fka/awesome-chatgpt-prompts\n", + "Updated\n", + "Jan 6\n", + "•\n", + "37.3k\n", + "•\n", + "9.27k\n", + "Agent-Ark/Toucan-1.5M\n", + "Updated\n", + "16 days ago\n", + "•\n", + "10.9k\n", + "•\n", + "135\n", + "nick007x/github-code-2025\n", + "Updated\n", + "4 days ago\n", + "•\n", + "6.19k\n", + "•\n", + "27\n", + "Browse 250k+ datasets\n", + "The Home of Machine Learning\n", + "Create, discover and collaborate on ML better.\n", + "The collaboration platform\n", + "Host and collaborate on unlimited public models, datasets and applications.\n", + "Move faster\n", + "With the HF Open source stack.\n", + "Explore all modalities\n", + "Text, image, video, audio or even 3D.\n", + "Build your portfolio\n", + "Share your work with the world and build your ML profile.\n", + "Sign Up\n", + "Accelerate your ML\n", + "We provide paid Compute and Enterprise solutions.\n", + "Team & Enterprise\n", + "Give your team the most advanced platform to build A\n", + "\n", + "### Link: brand page\n", + "Brand assets - Hugging Face\n", + "\n", + "Hugging Face\n", + "Models\n", + "Datasets\n", + "Spaces\n", + "Community\n", + "Docs\n", + "Enterprise\n", + "Pricing\n", + "Log In\n", + "Sign Up\n", + "Hugging Face · Brand assets\n", + "HF Logos\n", + ".svg\n", + ".png\n", + ".ai\n", + ".svg\n", + ".png\n", + ".ai\n", + ".svg\n", + ".png\n", + ".ai\n", + "HF Colors\n", + "#FFD21E\n", + "#FF9D00\n", + "#6B7280\n", + "HF Bio\n", + "Hugging Face is the collaboration platform for the machine learning community.\n", + "\n", + "The Hugging Face Hub works as a central place where anyone can share, explore, discover, and experiment with open-source ML. HF empowers the next generation of machine learning engineers, scientists, and end users to learn, collaborate and share their work to build an open and ethical AI future together.\n", + "\n", + "With the fast-growing community, some of the most used open-source ML libraries and tools, and a talented science team exploring the edge of tech, Hugging Face is at the heart of the AI revolution.\n", + "Copy to clipboard\n", + "HF Universe\n", + "Find other assets available for use from the Hugging Face brand universe\n", + "here\n", + ".\n", + "System theme\n", + "Website\n", + "Models\n", + "Datasets\n", + "Spaces\n", + "Changelog\n", + "Inference Endpoints\n", + "HuggingChat\n", + "Company\n", + "About\n", + "Brand assets\n", + "Terms of service\n", + "Privacy\n", + "Jobs\n", + "Press\n", + "Resources\n", + "Learn\n", + "Documentation\n", + "Blog\n", + "Forum\n", + "Service Status\n", + "Social\n", + "GitHub\n", + "Twitter\n", + "LinkedIn\n", + "Discord\n", + "\n", + "### Link: careers page\n", + "Hugging Face - Current Openings\n", + "\n", + "\n", + "\n", + "### Link: GitHub page\n", + "Hugging Face · GitHub\n", + "\n", + "Skip to content\n", + "Navigation Menu\n", + "Toggle navigation\n", + "Sign in\n", + "Appearance settings\n", + "huggingface\n", + "Platform\n", + "GitHub Copilot\n", + "Write better code with AI\n", + "GitHub Spark\n", + "New\n", + "Build and deploy intelligent apps\n", + "GitHub Models\n", + "New\n", + "Manage and compare prompts\n", + "GitHub Advanced Security\n", + "Find and fix vulnerabilities\n", + "Actions\n", + "Automate any workflow\n", + "Codespaces\n", + "Instant dev environments\n", + "Issues\n", + "Plan and track work\n", + "Code Review\n", + "Manage code changes\n", + "Discussions\n", + "Collaborate outside of code\n", + "Code Search\n", + "Find more, search less\n", + "Explore\n", + "Why GitHub\n", + "Documentation\n", + "GitHub Skills\n", + "Blog\n", + "Integrations\n", + "GitHub Marketplace\n", + "MCP Registry\n", + "View all features\n", + "Solutions\n", + "By company size\n", + "Enterprises\n", + "Small and medium teams\n", + "Startups\n", + "Nonprofits\n", + "By use case\n", + "App Modernization\n", + "DevSecOps\n", + "DevOps\n", + "CI/CD\n", + "View all use cases\n", + "By industry\n", + "Healthcare\n", + "Financial services\n", + "Manufacturing\n", + "Government\n", + "View all industries\n", + "View all solutions\n", + "Resources\n", + "Topics\n", + "AI\n", + "DevOps\n", + "Security\n", + "Software Development\n", + "View all\n", + "Explore\n", + "Learning Pathways\n", + "Events & Webinars\n", + "Ebooks & Whitepapers\n", + "Customer Stories\n", + "Partners\n", + "Executive Insights\n", + "Open Source\n", + "GitHub Sponsors\n", + "Fund open source developers\n", + "The ReadME Project\n", + "GitHub community articles\n", + "Repositories\n", + "Topics\n", + "Trending\n", + "Collections\n", + "Enterprise\n", + "Enterprise platform\n", + "AI-powered developer platform\n", + "Available add-ons\n", + "GitHub Advanced Security\n", + "Enterprise-grade security features\n", + "Copilot for business\n", + "Enterprise-grade AI features\n", + "Premium Support\n", + "Enterprise-grade 24/7 support\n", + "Pricing\n", + "Search or jump to...\n", + "Search code, repositories, users, issues, pull requests...\n", + "Search\n", + "Clear\n", + "Search syntax tips\n", + "Provide feedback\n", + "We read every piece of feedback, and take your input very seriously.\n", + "Include my email address so I can be contacted\n", + "Cancel\n", + "Submit feedback\n", + "Saved searches\n", + "Use saved searches to filter your results more quickly\n", + "Cancel\n", + "Create saved search\n", + "Sign in\n", + "Sign up\n", + "Appearance settings\n", + "Resetting focus\n", + "You signed in with another tab or window.\n", + "Reload\n", + "to refresh your session.\n", + "You signed out in another tab or window.\n", + "Reload\n", + "to refresh yo\n", + "\n", + "### Link: Twitter\n", + "No title found\n", + "\n", + "JavaScript is not available.\n", + "We’ve detected that JavaScript is disabled in this browser. Please enable JavaScript or switch to a supported browser to continue using x.com. You can see a list of supported browsers in our Help Center.\n", + "Help Center\n", + "Terms of Service\n", + "Privacy Policy\n", + "Cookie Policy\n", + "Imprint\n", + "Ads info\n", + "© 2025 X Corp.\n", + "Something went wrong, but don’t fret — let’s give it another shot.\n", + "Try again\n", + "Some privacy related extensions may cause issues on x.com. Please disable them and try again.\n", + "\n", + "### Link: LinkedIn\n", + "Hugging Face | LinkedIn\n", + "\n", + "Skip to main content\n", + "LinkedIn\n", + "Top Content\n", + "People\n", + "Learning\n", + "Jobs\n", + "Games\n", + "Get the app\n", + "Sign in\n", + "Join now\n", + "Hugging Face\n", + "Software Development\n", + "The AI community building the future.\n", + "See jobs\n", + "Follow\n", + "View all 632 employees\n", + "Report this company\n", + "About us\n", + "The AI community building the future.\n", + "Website\n", + "https://huggingface.co\n", + "External link for Hugging Face\n", + "Industry\n", + "Software Development\n", + "Company size\n", + "51-200 employees\n", + "Type\n", + "Privately Held\n", + "Founded\n", + "2016\n", + "Specialties\n", + "machine learning, natural language processing, and deep learning\n", + "Products\n", + "Hugging Face\n", + "Hugging Face\n", + "Natural Language Processing (NLP) Software\n", + "We’re on a journey to solve and democratize artificial intelligence through natural language.\n", + "Locations\n", + "Primary\n", + "Get directions\n", + "Paris, FR\n", + "Get directions\n", + "Employees at Hugging Face\n", + "Ludovic Huraux\n", + "Rajat Arya\n", + "Tech Lead & Software Engineer @ HF | prev: co-founder XetHub, Apple, Turi, AWS, Microsoft\n", + "Jeff Boudier\n", + "Product + Growth at Hugging Face\n", + "Terrence Rohan\n", + "Seed Investor\n", + "See all employees\n", + "Updates\n", + "Hugging Face\n", + "reposted this\n", + "Francesco Capuano\n", + "3h\n", + "Edited\n", + "Report this post\n", + "We just released a robotics course on\n", + "Hugging Face\n", + ", designed to make robot learning accessible to everyone 🤗\n", + "\n", + "You definitely want to take this self-paced (and entirely open-source!) course if you want to start learning about robotics, from classical robotics to the latest, most advanced learning algorithms out there!\n", + "\n", + "If you’re curious about how real-world robots learn, this is for you.\n", + "👉 Join the\n", + "Hugging Face\n", + "Robotics organization to follow along and explore:\n", + "🔗\n", + "https://lnkd.in/dPmZs7nh\n", + "In this course, you’ll learn how to:\n", + "🔴 Understand the basics of classical robotics\n", + "🔴 Apply Reinforcement Learning to real-world robots\n", + "🔴 Use generative models for imitation learning (VAEs, diffusion, flow matching)\n", + "🔴 Explore the latest generalist robot policies (like PI0 and SmolVLA!)\n", + "\n", + "Made with ❤️ by the Hugging Face team and the amazing\n", + "Ben Burtenshaw\n", + "🤗\n", + "\n", + "We’re working tirelessly to lower the barrier to entry for robotics, a\n", + "\n", + "### Link: Community forum\n", + "Hugging Face Forums - Hugging Face Community Discussion\n", + "\n", + "Hugging Face Forums\n", + "Topic\n", + "Replies\n", + "Views\n", + "Activity\n", + "Cannot load torchcodec\n", + "Beginners\n", + "1\n", + "7\n", + "October 19, 2025\n", + "Getting erro while loading kde4 dataset in collab\n", + "🤗Datasets\n", + "4\n", + "58\n", + "October 19, 2025\n", + "How to Fix \"Workload Evicted, Storage Limit Exceeded (50G)\" Error in HuggingFace Spaces\n", + "Beginners\n", + "0\n", + "5\n", + "October 19, 2025\n", + "[Show & Tell] Kanops. Open Access Retail Scenes (v0, 10k+, evaluation-only)\n", + "Show and Tell\n", + "0\n", + "4\n", + "October 18, 2025\n", + "Want my Flux LoRa model to work and also want to be able to train my own SD 1.5 and SDXL model\n", + "Beginners\n", + "1\n", + "23\n", + "October 18, 2025\n", + "Custom Domain stuck on pending renderly.us\n", + "Beginners\n", + "0\n", + "4\n", + "October 18, 2025\n", + "My space wont restart or rebuild\n", + "Spaces\n", + "7\n", + "42\n", + "October 14, 2025\n", + "Possible issue of contentUrl in croissant file of the dataset\n", + "🤗Datasets\n", + "2\n", + "14\n", + "October 18, 2025\n", + "[HF Space not starting] Repeatedly crashes: @semmyKG]\n", + "Spaces\n", + "1\n", + "13\n", + "October 17, 2025\n", + "Best open-source model for parsing messy PDFs on 16GB RAM (CPU only)\n", + "Models\n", + "20\n", + "243\n", + "October 18, 2025\n", + "A program to use all modules\n", + "Beginners\n", + "14\n", + "70\n", + "October 13, 2025\n", + "PhotoMaker V2 not working anyone fix it?\n", + "Spaces\n", + "2\n", + "15\n", + "October 17, 2025\n", + "\"Your space is in error, check its status on hf.co\", but it is running fine in the app window?\n", + "Beginners\n", + "2\n", + "11\n", + "October 17, 2025\n", + "Seeking Advice on Fine-Tuning a Legal Language Model for Nepalese Law (LLM + RAG)\n", + "🤗 Course Projects\n", + "1\n", + "250\n", + "October 18, 2025\n", + "Space doesn't work\n", + "Beginners\n", + "2\n", + "19\n", + "October 17, 2025\n", + "Running a docker image from external docker registry in a job\n", + "Beginners\n", + "0\n", + "8\n", + "October 16, 2025\n", + "401 - but my API key should be valid\n", + "Beginners\n", + "4\n", + "28\n", + "October 16, 2025\n", + "Unable to get docker image from docker space\n", + "Intermediate\n", + "0\n", + "8\n", + "October 16, 2025\n", + "Custom domain Huggingface\n", + "Beginners\n", + "7\n", + "205\n", + "October 18, 2025\n", + "Help with training AI\n", + "Beginners\n", + "1\n", + "20\n", + "October 17, 2025\n", + "Upload a large folder from S3 to a dataset\n", + "🤗Datasets\n", + "3\n", + "14\n", + "October 15, 2025\n", + "[HELP] custom trained VLM ignoring input image.\n", + "Models\n", + "1\n", + "8\n", + "October 17, 2025\n", + "How to avert 'loading checkpoint shards'?\n", + "🤗Transfo\n" + ] + } + ], + "source": [ + "print(fetch_page_and_all_relevant_links(\"https://huggingface.co\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "9b863a55-f86c-4e3f-8a79-94e24c1a8cf2", + "metadata": {}, + "outputs": [], + "source": [ + "brochure_system_prompt = \"\"\"\n", + "You are an assistant that analyzes the contents of several relevant pages from a company website\n", + "and creates a short brochure about the company for prospective customers, investors and recruits.\n", + "Respond in markdown without code blocks.\n", + "Include details of company culture, customers and careers/jobs if you have the information.\n", + "\"\"\"\n", + "\n", + "# Or uncomment the lines below for a more humorous brochure - this demonstrates how easy it is to incorporate 'tone':\n", + "\n", + "# brochure_system_prompt = \"\"\"\n", + "# You are an assistant that analyzes the contents of several relevant pages from a company website\n", + "# and creates a short, humorous, entertaining, witty brochure about the company for prospective customers, investors and recruits.\n", + "# Respond in markdown without code blocks.\n", + "# Include details of company culture, customers and careers/jobs if you have the information.\n", + "# \"\"\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "6ab83d92-d36b-4ce0-8bcc-5bb4c2f8ff23", + "metadata": {}, + "outputs": [], + "source": [ + "def get_brochure_user_prompt(company_name, url):\n", + " user_prompt = f\"\"\"\n", + "You are looking at a company called: {company_name}\n", + "Here are the contents of its landing page and other relevant pages;\n", + "use this information to build a short brochure of the company in markdown without code blocks.\\n\\n\n", + "\"\"\"\n", + " user_prompt += fetch_page_and_all_relevant_links(url)\n", + " user_prompt = user_prompt[:5_000] # Truncate if more than 5,000 characters\n", + " return user_prompt" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "cd909e0b-1312-4ce2-a553-821e795d7572", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selecting relevant links for https://huggingface.co by calling gpt-5-nano\n", + "Found 14 relevant links\n" + ] + }, + { + "data": { + "text/plain": [ + "'\\nYou are looking at a company called: HuggingFace\\nHere are the contents of its landing page and other relevant pages;\\nuse this information to build a short brochure of the company in markdown without code blocks.\\n\\n\\n## Landing Page:\\n\\nHugging Face – The AI community building the future.\\n\\nHugging Face\\nModels\\nDatasets\\nSpaces\\nCommunity\\nDocs\\nEnterprise\\nPricing\\nLog In\\nSign Up\\nNEW\\nTry HuggingChat Omni – Chat with AI 💬\\nGet started with Inference in seconds 🚀\\nReachy Mini: The Open Robot for AI Builders\\nThe AI community building the future.\\nThe platform where the machine learning community collaborates on models, datasets, and applications.\\nExplore AI Apps\\nor\\nBrowse 1M+ models\\nTrending on\\nthis week\\nModels\\nPaddlePaddle/PaddleOCR-VL\\nUpdated\\n1 day ago\\n•\\n3.82k\\n•\\n611\\nnanonets/Nanonets-OCR2-3B\\nUpdated\\n3 days ago\\n•\\n12.8k\\n•\\n317\\nQwen/Qwen3-VL-8B-Instruct\\nUpdated\\n4 days ago\\n•\\n74.5k\\n•\\n186\\nPhr00t/Qwen-Image-Edit-Rapid-AIO\\nUpdated\\nabout 17 hours ago\\n•\\n350\\ninclusionAI/Ling-1T\\nUpdated\\n5 days ago\\n•\\n3k\\n•\\n450\\nBrowse 1M+ models\\nSpaces\\nRunning\\n299\\n299\\nveo3.1-fast\\n🐨\\nGenerate videos from text or images\\nRunning\\n15.2k\\n15.2k\\nDeepSite v3\\n🐳\\nGenerate any application by Vibe Coding\\nRunning\\n328\\n328\\nSora 2\\n📉\\nGenerate videos from text or images\\nRunning\\n1.93k\\n1.93k\\nWan2.2 Animate\\n👁\\nWan2.2 Animate\\nRunning\\non\\nZero\\nMCP\\n1.8k\\n1.8k\\nWan2.2 14B Fast\\n🎥\\ngenerate a video from an image with a text prompt\\nBrowse 400k+ applications\\nDatasets\\nkarpathy/fineweb-edu-100b-shuffle\\nUpdated\\n24 days ago\\n•\\n19.5k\\n•\\n55\\nSalesforce/Webscale-RL\\nUpdated\\n6 days ago\\n•\\n6.91k\\n•\\n70\\nfka/awesome-chatgpt-prompts\\nUpdated\\nJan 6\\n•\\n37.3k\\n•\\n9.27k\\nAgent-Ark/Toucan-1.5M\\nUpdated\\n16 days ago\\n•\\n10.9k\\n•\\n135\\nnick007x/github-code-2025\\nUpdated\\n4 days ago\\n•\\n6.19k\\n•\\n27\\nBrowse 250k+ datasets\\nThe Home of Machine Learning\\nCreate, discover and collaborate on ML better.\\nThe collaboration platform\\nHost and collaborate on unlimited public models, datasets and applications.\\nMove faster\\nWith the HF Open source stack.\\nExplore all modalities\\nText, image, video, audio or even 3D.\\nBuild your portfolio\\nShare your work with the world and build your ML profile.\\nSign Up\\nAccelerate your ML\\nWe provide paid Compute and Enterprise solutions.\\nTeam & Enterprise\\nGive your team the most advanced platform to build AI\\n## Relevant Links:\\n\\n\\n### Link: home page\\nHugging Face – The AI community building the future.\\n\\nHugging Face\\nModels\\nDatasets\\nSpaces\\nCommunity\\nDocs\\nEnterprise\\nPricing\\nLog In\\nSign Up\\nNEW\\nTry HuggingChat Omni – Chat with AI 💬\\nGet started with Inference in seconds 🚀\\nReachy Mini: The Open Robot for AI Builders\\nThe AI community building the future.\\nThe platform where the machine learning community collaborates on models, datasets, and applications.\\nExplore AI Apps\\nor\\nBrowse 1M+ models\\nTrending on\\nthis week\\nModels\\nPaddlePaddle/PaddleOCR-VL\\nUpdated\\n1 day ago\\n•\\n3.82k\\n•\\n611\\nnanonets/Nanonets-OCR2-3B\\nUpdated\\n3 days ago\\n•\\n12.8k\\n•\\n317\\nQwen/Qwen3-VL-8B-Instruct\\nUpdated\\n4 days ago\\n•\\n74.5k\\n•\\n186\\nPhr00t/Qwen-Image-Edit-Rapid-AIO\\nUpdated\\nabout 17 hours ago\\n•\\n350\\ninclusionAI/Ling-1T\\nUpdated\\n5 days ago\\n•\\n3k\\n•\\n450\\nBrowse 1M+ models\\nSpaces\\nRunning\\n299\\n299\\nveo3.1-fast\\n🐨\\nGenerate videos from text or images\\nRunning\\n15.2k\\n15.2k\\nDeepSite v3\\n🐳\\nGenerate any application by Vibe Coding\\nRunning\\n328\\n328\\nSora 2\\n📉\\nGenerate videos from text or images\\nRunning\\n1.93k\\n1.93k\\nWan2.2 Animate\\n👁\\nWan2.2 Animate\\nRunning\\non\\nZero\\nMCP\\n1.8k\\n1.8k\\nWan2.2 14B Fast\\n🎥\\ngenerate a video from an image with a text prompt\\nBrowse 400k+ applications\\nDatasets\\nkarpathy/fineweb-edu-100b-shuffle\\nUpdated\\n24 days ago\\n•\\n19.5k\\n•\\n55\\nSalesforce/Webscale-RL\\nUpdated\\n6 days ago\\n•\\n6.91k\\n•\\n70\\nfka/awesome-chatgpt-prompts\\nUpdated\\nJan 6\\n•\\n37.3k\\n•\\n9.27k\\nAgent-Ark/Toucan-1.5M\\nUpdated\\n16 days ago\\n•\\n10.9k\\n•\\n135\\nnick007x/github-code-2025\\nUpdated\\n4 days ago\\n•\\n6.19k\\n•\\n27\\nBrowse 250k+ datasets\\nThe Home of Machine Learning\\nCreate, discover and collaborate on ML better.\\nThe collaboration platform\\nHost and collaborate on unlimited public models, datasets and applications.\\nMove faster\\nWith the HF Open source stack.\\nExplore all modalities\\nText, image, video, audio or even 3D.\\nBuild your portfolio\\nShare your work with the world and build your ML profile.\\nSign Up\\nAccelerate your ML\\nWe provide paid Compute and Enterprise solutions.\\nTeam & Enterprise\\nGive your team the most advanced platform to build AI\\n\\n### Link: brand page\\nBrand assets - Hugging Face\\n\\nHugging Face\\nModels\\nDatasets\\nSpaces\\nCommunity\\nDocs\\nEnterprise\\nPricing\\nLog In\\nSign Up\\nHugging Face · Brand assets\\nHF Logos\\n.svg\\n.png\\n.ai\\n.svg\\n.png\\n.ai\\n.svg\\n.png\\n.ai\\nHF Colors\\n#FFD21E\\n#FF9D00\\n#6B7280\\nHF Bio\\nHugging Face is the collaboration platform for the machine learning community.\\n\\nThe Hugging Face Hub works as a central place where anyone can share, explore, discover, and experiment with open-source ML. HF empowers the next generation of machine learning engineers, scientists, and end users to learn, collaborate and share their work to build an open and ethical AI future together.\\n\\nWith the fast-growing community, some of the most used open-source ML libraries a'" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_brochure_user_prompt(\"HuggingFace\", \"https://huggingface.co\")" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "8b45846d", + "metadata": {}, + "outputs": [], + "source": [ + "def create_brochure(company_name, url):\n", + " response = openai.chat.completions.create(\n", + " model=\"gpt-4.1-mini\",\n", + " messages=[\n", + " {\"role\": \"system\", \"content\": brochure_system_prompt},\n", + " {\"role\": \"user\", \"content\": get_brochure_user_prompt(company_name, url)}\n", + " ],\n", + " )\n", + " result = response.choices[0].message.content\n", + " display(Markdown(result))\n", + " return result\n", + "\n", + "def translate_brochure(brochure_content, language=\"Hindi\"):\n", + " system_prompt = f\"\"\"\n", + " You are a skilled marketing translator.\n", + " Translate the following brochure text into idiomatic {language}.\n", + " Match the tone and style of native marketing materials.\n", + " Output in Markdown.\n", + " \"\"\"\n", + " response = openai.chat.completions.create(\n", + " model=MODEL,\n", + " messages=[\n", + " {\"role\": \"system\", \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": brochure_content}\n", + " ],\n", + " )\n", + " translated = response.choices[0].message.content\n", + " display(Markdown(f\"### 🌍 Translated Brochure ({language})\\n\\n{translated}\"))\n", + " return translated" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "b123615a", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selecting relevant links for https://huggingface.co by calling gpt-5-nano\n", + "Found 12 relevant links\n" + ] + }, + { + "data": { + "text/markdown": [ + "# Hugging Face: Building the Future of AI Together\n", + "\n", + "---\n", + "\n", + "## About Hugging Face\n", + "\n", + "Hugging Face is at the heart of the AI revolution, serving as the premier collaboration platform for the machine learning community. We empower machine learning engineers, scientists, and developers worldwide to share, discover, and build open and ethical AI solutions. Our mission is clear: **to democratize quality machine learning — one commit at a time.**\n", + "\n", + "The Hugging Face Hub is a vibrant ecosystem where people can host and collaborate on unlimited models, datasets, and applications, accelerating AI innovation through community and open-source tools.\n", + "\n", + "---\n", + "\n", + "## What We Offer\n", + "\n", + "### Models & Datasets \n", + "- Browse **1 million+ models** including cutting-edge NLP, vision, audio, and multimodal models. \n", + "- Access **250,000+ datasets** curated by the community to fuel your AI projects. \n", + "\n", + "### Spaces \n", + "- Explore and deploy ML applications with over **400,000+ applications** running in the community. \n", + "- Share your own AI apps effortlessly with our collaborative platform.\n", + "\n", + "### Infrastructure \n", + "- Get started with **fast and easy inference** to integrate AI models in seconds. \n", + "- Enterprise-grade compute solutions and powerful APIs built for team collaboration and scaling AI projects.\n", + "\n", + "---\n", + "\n", + "## Our Community & Culture\n", + "\n", + "- A **fast-growing, diverse, and passionate** community of 200+ team members and over 64,000 followers dedicated to open-source AI. \n", + "- We believe in **open science**, collaboration, and ethical AI development. \n", + "- Hugging Face hosts a rich ecosystem where users can **build portfolios, share their ML work, and grow their expertise**. \n", + "\n", + "### Core Values \n", + "- **Openness:** Everything we build is designed to be accessible and community-driven. \n", + "- **Collaboration:** We foster an environment where learning and innovation happen through shared efforts. \n", + "- **Ethics:** We are committed to building AI responsibly to benefit humanity.\n", + "\n", + "---\n", + "\n", + "## Customers & Use Cases\n", + "\n", + "Our platform supports a broad spectrum of users, from individual researchers and AI enthusiasts to large enterprises, including:\n", + "\n", + "- Machine learning researchers leveraging open datasets and pre-trained models. \n", + "- Enterprises accelerating AI adoption with custom integration and enterprise solutions. \n", + "- Developers creating next-gen AI applications across text, vision, audio, and video modalities.\n", + "\n", + "---\n", + "\n", + "## Careers at Hugging Face\n", + "\n", + "Join a team that is shaping the future of AI! \n", + "We are looking for passionate engineers, researchers, and innovators who want to:\n", + "\n", + "- Work on **state-of-the-art models and open source AI tools**. \n", + "- Collaborate with a **global community of AI pioneers**. \n", + "- Grow their careers in a **dynamic, inclusive, and mission-driven environment**.\n", + "\n", + "For current job openings and application details, visit our [Jobs Page](https://huggingface.co/jobs).\n", + "\n", + "---\n", + "\n", + "## Get Involved\n", + "\n", + "- Explore models and datasets: https://huggingface.co/models \n", + "- Try AI applications on Spaces: https://huggingface.co/spaces \n", + "- Join the community discussions on [Discord](https://discord.gg/huggingface) and follow us on [Twitter](https://twitter.com/huggingface). \n", + "\n", + "Together, let's build an open and ethical AI future.\n", + "\n", + "---\n", + "\n", + "**Hugging Face** \n", + "The AI community building the future. \n", + "[https://huggingface.co](https://huggingface.co) \n", + "\n", + "---\n", + "\n", + "### Brand Colors \n", + "- Yellow: #FFD21E \n", + "- Orange: #FF9D00 \n", + "- Gray: #6B7280\n", + "\n", + "---\n", + "\n", + "*Empowering the AI community — one commit at a time.*" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "### 🌍 Translated Brochure (Spanish)\n", + "\n", + "```markdown\n", + "# Hugging Face: Construyendo el Futuro de la IA Juntos\n", + "\n", + "---\n", + "\n", + "## Sobre Hugging Face\n", + "\n", + "Hugging Face está en el corazón de la revolución de la IA, sirviendo como la principal plataforma de colaboración para la comunidad de aprendizaje automático. Empoderamos a ingenieros, científicos y desarrolladores de aprendizaje automático en todo el mundo para compartir, descubrir y construir soluciones de IA abiertas y éticas. Nuestra misión es clara: **democratizar el aprendizaje automático de calidad — un commit a la vez.**\n", + "\n", + "El Hugging Face Hub es un ecosistema vibrante donde las personas pueden alojar y colaborar en modelos ilimitados, conjuntos de datos y aplicaciones, acelerando la innovación en IA a través de la comunidad y herramientas de código abierto.\n", + "\n", + "---\n", + "\n", + "## Lo Que Ofrecemos\n", + "\n", + "### Modelos y Conjuntos de Datos \n", + "- Navega **más de 1 millón de modelos** que incluyen modelos avanzados de PLN, visión, audio y multimodalidad. \n", + "- Accede a **más de 250,000 conjuntos de datos** seleccionados por la comunidad para impulsar tus proyectos de IA. \n", + "\n", + "### Spaces \n", + "- Explora y despliega aplicaciones de aprendizaje automático con más de **400,000 aplicaciones** funcionando en la comunidad. \n", + "- Comparte tus propias aplicaciones de IA sin esfuerzo con nuestra plataforma colaborativa.\n", + "\n", + "### Infraestructura \n", + "- Comienza con **inferencia rápida y sencilla** para integrar modelos de IA en segundos. \n", + "- Soluciones de computación de nivel empresarial y poderosas API diseñadas para la colaboración en equipo y la escalabilidad de proyectos de IA.\n", + "\n", + "---\n", + "\n", + "## Nuestra Comunidad y Cultura\n", + "\n", + "- Una comunidad **rápida, diversa y apasionada** con más de 200 miembros en el equipo y más de 64,000 seguidores dedicados a la IA de código abierto. \n", + "- Creemos en la **ciencia abierta**, la colaboración y el desarrollo ético de la IA. \n", + "- Hugging Face alberga un ecosistema rico donde los usuarios pueden **construir portafolios, compartir su trabajo de aprendizaje automático y crecer en su experiencia**. \n", + "\n", + "### Valores Fundamentales \n", + "- **Apertura:** Todo lo que construimos está diseñado para ser accesible y dirigido por la comunidad. \n", + "- **Colaboración:** Fomentamos un ambiente donde el aprendizaje y la innovación ocurren a través del esfuerzo compartido. \n", + "- **Ética:** Estamos comprometidos a construir IA responsablemente para beneficiar a la humanidad.\n", + "\n", + "---\n", + "\n", + "## Clientes y Casos de Uso\n", + "\n", + "Nuestra plataforma soporta un amplio espectro de usuarios, desde investigadores individuales y entusiastas de la IA hasta grandes empresas, incluyendo:\n", + "\n", + "- Investigadores en aprendizaje automático que aprovechan conjuntos de datos abiertos y modelos preentrenados. \n", + "- Empresas que aceleran la adopción de IA con integración personalizada y soluciones empresariales. \n", + "- Desarrolladores creando aplicaciones de IA de próxima generación en modalidades de texto, visión, audio y video.\n", + "\n", + "---\n", + "\n", + "## Carreras en Hugging Face\n", + "\n", + "¡Únete a un equipo que está moldeando el futuro de la IA! \n", + "Buscamos ingenieros, investigadores e innovadores apasionados que quieran:\n", + "\n", + "- Trabajar en **modelos de última generación y herramientas de IA de código abierto**. \n", + "- Colaborar con una **comunidad global de pioneros en IA**. \n", + "- Desarrollar su carrera en un **entorno dinámico, inclusivo y orientado a la misión**.\n", + "\n", + "Para vacantes actuales y detalles de aplicación, visita nuestra [Página de Empleos](https://huggingface.co/jobs).\n", + "\n", + "---\n", + "\n", + "## Participa\n", + "\n", + "- Explora modelos y conjuntos de datos: https://huggingface.co/models \n", + "- Prueba aplicaciones de IA en Spaces: https://huggingface.co/spaces \n", + "- Únete a las discusiones de la comunidad en [Discord](https://discord.gg/huggingface) y síguenos en [Twitter](https://twitter.com/huggingface). \n", + "\n", + "Juntos, construyamos un futuro abierto y ético para la IA.\n", + "\n", + "---\n", + "\n", + "**Hugging Face** \n", + "La comunidad de IA que construye el futuro. \n", + "[https://huggingface.co](https://huggingface.co) \n", + "\n", + "---\n", + "\n", + "### Colores de Marca \n", + "- Amarillo: #FFD21E \n", + "- Naranja: #FF9D00 \n", + "- Gris: #6B7280\n", + "\n", + "---\n", + "\n", + "*Empoderando a la comunidad de IA — un commit a la vez.*\n", + "```" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "'```markdown\\n# Hugging Face: Construyendo el Futuro de la IA Juntos\\n\\n---\\n\\n## Sobre Hugging Face\\n\\nHugging Face está en el corazón de la revolución de la IA, sirviendo como la principal plataforma de colaboración para la comunidad de aprendizaje automático. Empoderamos a ingenieros, científicos y desarrolladores de aprendizaje automático en todo el mundo para compartir, descubrir y construir soluciones de IA abiertas y éticas. Nuestra misión es clara: **democratizar el aprendizaje automático de calidad — un commit a la vez.**\\n\\nEl Hugging Face Hub es un ecosistema vibrante donde las personas pueden alojar y colaborar en modelos ilimitados, conjuntos de datos y aplicaciones, acelerando la innovación en IA a través de la comunidad y herramientas de código abierto.\\n\\n---\\n\\n## Lo Que Ofrecemos\\n\\n### Modelos y Conjuntos de Datos \\n- Navega **más de 1 millón de modelos** que incluyen modelos avanzados de PLN, visión, audio y multimodalidad. \\n- Accede a **más de 250,000 conjuntos de datos** seleccionados por la comunidad para impulsar tus proyectos de IA. \\n\\n### Spaces \\n- Explora y despliega aplicaciones de aprendizaje automático con más de **400,000 aplicaciones** funcionando en la comunidad. \\n- Comparte tus propias aplicaciones de IA sin esfuerzo con nuestra plataforma colaborativa.\\n\\n### Infraestructura \\n- Comienza con **inferencia rápida y sencilla** para integrar modelos de IA en segundos. \\n- Soluciones de computación de nivel empresarial y poderosas API diseñadas para la colaboración en equipo y la escalabilidad de proyectos de IA.\\n\\n---\\n\\n## Nuestra Comunidad y Cultura\\n\\n- Una comunidad **rápida, diversa y apasionada** con más de 200 miembros en el equipo y más de 64,000 seguidores dedicados a la IA de código abierto. \\n- Creemos en la **ciencia abierta**, la colaboración y el desarrollo ético de la IA. \\n- Hugging Face alberga un ecosistema rico donde los usuarios pueden **construir portafolios, compartir su trabajo de aprendizaje automático y crecer en su experiencia**. \\n\\n### Valores Fundamentales \\n- **Apertura:** Todo lo que construimos está diseñado para ser accesible y dirigido por la comunidad. \\n- **Colaboración:** Fomentamos un ambiente donde el aprendizaje y la innovación ocurren a través del esfuerzo compartido. \\n- **Ética:** Estamos comprometidos a construir IA responsablemente para beneficiar a la humanidad.\\n\\n---\\n\\n## Clientes y Casos de Uso\\n\\nNuestra plataforma soporta un amplio espectro de usuarios, desde investigadores individuales y entusiastas de la IA hasta grandes empresas, incluyendo:\\n\\n- Investigadores en aprendizaje automático que aprovechan conjuntos de datos abiertos y modelos preentrenados. \\n- Empresas que aceleran la adopción de IA con integración personalizada y soluciones empresariales. \\n- Desarrolladores creando aplicaciones de IA de próxima generación en modalidades de texto, visión, audio y video.\\n\\n---\\n\\n## Carreras en Hugging Face\\n\\n¡Únete a un equipo que está moldeando el futuro de la IA! \\nBuscamos ingenieros, investigadores e innovadores apasionados que quieran:\\n\\n- Trabajar en **modelos de última generación y herramientas de IA de código abierto**. \\n- Colaborar con una **comunidad global de pioneros en IA**. \\n- Desarrollar su carrera en un **entorno dinámico, inclusivo y orientado a la misión**.\\n\\nPara vacantes actuales y detalles de aplicación, visita nuestra [Página de Empleos](https://huggingface.co/jobs).\\n\\n---\\n\\n## Participa\\n\\n- Explora modelos y conjuntos de datos: https://huggingface.co/models \\n- Prueba aplicaciones de IA en Spaces: https://huggingface.co/spaces \\n- Únete a las discusiones de la comunidad en [Discord](https://discord.gg/huggingface) y síguenos en [Twitter](https://twitter.com/huggingface). \\n\\nJuntos, construyamos un futuro abierto y ético para la IA.\\n\\n---\\n\\n**Hugging Face** \\nLa comunidad de IA que construye el futuro. \\n[https://huggingface.co](https://huggingface.co) \\n\\n---\\n\\n### Colores de Marca \\n- Amarillo: #FFD21E \\n- Naranja: #FF9D00 \\n- Gris: #6B7280\\n\\n---\\n\\n*Empoderando a la comunidad de IA — un commit a la vez.*\\n```'" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "brochure = create_brochure(\"HuggingFace\", \"https://huggingface.co\")\n", + "translate_text(brochure, \"Spanish\")" + ] + }, + { + "cell_type": "markdown", + "id": "61eaaab7-0b47-4b29-82d4-75d474ad8d18", + "metadata": {}, + "source": [ + "## Finally - a minor improvement\n", + "\n", + "With a small adjustment, we can change this so that the results stream back from OpenAI,\n", + "with the familiar typewriter animation" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "51db0e49-f261-4137-aabe-92dd601f7725", + "metadata": {}, + "outputs": [], + "source": [ + "def stream_brochure(company_name, url):\n", + " stream = openai.chat.completions.create(\n", + " model=\"gpt-4.1-mini\",\n", + " messages=[\n", + " {\"role\": \"system\", \"content\": brochure_system_prompt},\n", + " {\"role\": \"user\", \"content\": get_brochure_user_prompt(company_name, url)}\n", + " ],\n", + " stream=True\n", + " ) \n", + " response = \"\"\n", + " display_handle = display(Markdown(\"\"), display_id=True)\n", + " for chunk in stream:\n", + " response += chunk.choices[0].delta.content or ''\n", + " update_display(Markdown(response), display_id=display_handle.display_id)" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "56bf0ae3-ee9d-4a72-9cd6-edcac67ceb6d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selecting relevant links for https://huggingface.co by calling gpt-5-nano\n", + "Found 9 relevant links\n" + ] + }, + { + "data": { + "text/markdown": [ + "# Hugging Face: The AI Community Building the Future\n", + "\n", + "---\n", + "\n", + "## About Hugging Face\n", + "\n", + "Hugging Face is a vibrant and fast-growing AI and machine learning community dedicated to advancing the future of open and ethical AI. It serves as a collaboration platform where machine learning engineers, scientists, and enthusiasts from around the world create, discover, and share machine learning models, datasets, and applications.\n", + "\n", + "The Hugging Face Hub is the central place for hosting and collaborating on over **1 million models**, **250k+ datasets**, and **400k+ applications** spanning multiple modalities including text, images, video, audio, and 3D.\n", + "\n", + "---\n", + "\n", + "## What Hugging Face Offers\n", + "\n", + "- **Models:** Browse and explore a vast collection of AI models, updated frequently by a diverse community. Popular trending models include image generators, video editors, and language models.\n", + " \n", + "- **Datasets:** Access a rich catalog of datasets ranging from natural language prompts to persona datasets and beyond, enabling rapid model training and experimentation.\n", + " \n", + "- **Spaces:** Deploy, share, and run AI applications on Hugging Face's platform, including innovative tools such as video generation from images, AI toolkits, and interactive applications.\n", + "\n", + "- **Compute:** Easily accelerate your machine learning workloads with optimized inference endpoints and GPU-backed applications starting as low as $0.60/hour.\n", + "\n", + "- **Enterprise Solutions:** Hugging Face provides tailored enterprise offerings to help organizations harness AI technology securely and effectively at scale.\n", + "\n", + "---\n", + "\n", + "## Company Culture\n", + "\n", + "Hugging Face fosters an **open, collaborative, and ethical AI community** — empowering developers and researchers to work together transparently and inclusively. The culture emphasizes:\n", + "\n", + "- **Community-driven innovation:** Encouraging open-source contributions and sharing knowledge.\n", + "- **Ethical AI development:** Committed to building responsible AI systems for the benefit of all.\n", + "- **Diversity and inclusion:** Supporting a broad and global community in building AI tools and resources.\n", + "- **Learning and growth:** Offering a platform for users to build their machine learning portfolios and grow their expertise.\n", + "\n", + "---\n", + "\n", + "## Customers & Community\n", + "\n", + "Hugging Face serves a global community that includes:\n", + "\n", + "- Machine learning researchers and practitioners\n", + "- Developers building innovative AI applications\n", + "- Enterprises seeking scalable AI solutions\n", + "- AI enthusiasts and learners who want to experiment and grow their skills\n", + "\n", + "With over a million models and hundreds of thousands of datasets and applications, the platform connects users with cutting-edge AI technologies from companies like Tencent, NVIDIA, Facebook, and OpenAI — showcasing the power of open collaboration.\n", + "\n", + "---\n", + "\n", + "## Careers at Hugging Face\n", + "\n", + "Interested in joining Hugging Face? The company values talented individuals passionate about AI, open-source technologies, and community building. Opportunities include roles in:\n", + "\n", + "- Machine learning research & engineering\n", + "- Software development\n", + "- Cloud infrastructure and compute optimization\n", + "- Community management and developer relations\n", + "- Enterprise solutions & sales\n", + "\n", + "At Hugging Face, you will work at the forefront of AI innovation while contributing to a global, open, and ethical AI movement.\n", + "\n", + "---\n", + "\n", + "## Get Involved\n", + "\n", + "- **Explore AI models and datasets:** Visit [huggingface.co](https://huggingface.co) to browse millions of resources.\n", + "- **Build and share your own models and apps:** Create your portfolio in an open, collaborative environment.\n", + "- **Accelerate your projects:** Utilize Hugging Face’s Compute and Enterprise services.\n", + "- **Join the community:** Engage with thousands of practitioners working toward the future of AI.\n", + "\n", + "---\n", + "\n", + "### Contact & Follow\n", + "\n", + "- Website: [https://huggingface.co](https://huggingface.co)\n", + "- Join the community to learn, collaborate, and innovate in AI!\n", + "\n", + "---\n", + "\n", + "*Hugging Face — Empowering the next generation of machine learning for a better, open future.*" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "stream_brochure(\"HuggingFace\", \"https://huggingface.co\")" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "fdb3f8d8-a3eb-41c8-b1aa-9f60686a653b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selecting relevant links for https://huggingface.co by calling gpt-5-nano\n", + "Found 14 relevant links\n" + ] + }, + { + "data": { + "text/markdown": [ + "# Welcome to Hugging Face – The AI Community Building the Future!\n", + "\n", + "---\n", + "\n", + "## Who Are We? \n", + "Imagine a place where machine learning wizards, data sorcerers, and AI alchemists gather to share their spells — uh, models — datasets, and apps. That’s Hugging Face! We’re *the* platform where the AI community collaborates, creates, and sometimes even has a little fun while building the future.\n", + "\n", + "Our motto? **\"Keep it open. Keep it ethical. Keep it hugging.\"** 💛\n", + "\n", + "---\n", + "\n", + "## What’s Cooking in the AI Kitchen?\n", + "\n", + "- **1 Million+ Models** — From image generators to language wizards, our treasure trove of open-source ML models grows faster than you can say \"neural network.\" \n", + "- **250,000+ Datasets** — Feeding AI brains with everything from chat prompts to persona profiles. Hungry for data? Dig in! \n", + "- **400,000+ Applications & Spaces** — Launch apps, share your ML portfolio, or just show off cool demos that make your friends say, “Whoa, AI can do that?” \n", + "- **Multimodal Madness** — Text, image, video, audio, even 3D...if AI had a Swiss Army knife, we’d be it. \n", + "\n", + "---\n", + "\n", + "## Customers & Community \n", + "Whether you’re a student trying to get your AI feet wet, a startup looking to scale your genius, or an enterprise aiming to deploy heavy-duty models in the real world, Hugging Face has your back.\n", + "\n", + "With the fastest growing community of *machine learning enthusiasts* and the support of some seriously big names and organizations, here’s a place where:\n", + "\n", + "- **Freelancers** can build a portfolio and get noticed. \n", + "- **Researchers** can push boundaries openly and ethically. \n", + "- **Businesses** can accelerate AI adoption with our paid Compute and Enterprise suites. \n", + "\n", + "Join 1.29k+ Spaces and thousands more running models that power everything from video generation to AI-powered image editing.\n", + "\n", + "---\n", + "\n", + "## Culture & Career – Geek Out with Us! \n", + "We believe collaboration beats isolation every day. Our culture?\n", + "\n", + "- Open source at heart ❤️ \n", + "- Ethical AI advocates \n", + "- Casual tea-drinkers and serious problem solvers \n", + "- Always learning, always sharing, always growing \n", + "\n", + "Want to build machine learning tools that millions will use? Hugging Face is where your skills meet endless possibilities. From ML engineers to community managers, our doors are wide open (virtual hugs included).\n", + "\n", + "---\n", + "\n", + "## Speed Up Your AI Journey \n", + "No need to code in the dark alone or fight for GPU time — deploy models and apps with a few clicks on optimized inference endpoints, starting at just $0.60/hour for GPU!\n", + "\n", + "Whether you want to host that killer new model or just tweak an existing one, we give you the tools and community support to **move faster, build smarter, and hug tighter**.\n", + "\n", + "---\n", + "\n", + "## Quick Hugging Face Facts \n", + "- **Founded:** Around the corner from the future \n", + "- **Colors:** Bright yellow (#FFD21E), orange (#FF9D00), and sleek gray (#6B7280) — because AI should be as vibrant as its ideas! \n", + "- **Mascot:** Friendly face with a warm smile (because AIs could learn a thing or two about friendliness here) \n", + "\n", + "---\n", + "\n", + "## Ready to Join the AI Hug Circle? \n", + "\n", + "Sign up, share your work, explore millions of models and datasets, and get your AI career (or project!) hugging new heights.\n", + "\n", + "[Explore AI Apps](#) | [Browse 1M+ Models](#) | [Sign Up & Join The Fun](#)\n", + "\n", + "---\n", + "\n", + "*Hugging Face — where the future of AI isn’t just created; it’s hugged into existence.* 🤗✨" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Try changing the system prompt to the humorous version when you make the Brochure for Hugging Face:\n", + "\n", + "stream_brochure(\"HuggingFace\", \"https://huggingface.co\")" + ] + }, + { + "cell_type": "markdown", + "id": "a27bf9e0-665f-4645-b66b-9725e2a959b5", + "metadata": {}, + "source": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + "

Business applications

\n", + " In this exercise we extended the Day 1 code to make multiple LLM calls, and generate a document.\n", + "\n", + "This is perhaps the first example of Agentic AI design patterns, as we combined multiple calls to LLMs. This will feature more in Week 2, and then we will return to Agentic AI in a big way in Week 8 when we build a fully autonomous Agent solution.\n", + "\n", + "Generating content in this way is one of the very most common Use Cases. As with summarization, this can be applied to any business vertical. Write marketing content, generate a product tutorial from a spec, create personalized email content, and so much more. Explore how you can apply content generation to your business, and try making yourself a proof-of-concept prototype. See what other students have done in the community-contributions folder -- so many valuable projects -- it's wild!\n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "14b2454b-8ef8-4b5c-b928-053a15e0d553", + "metadata": {}, + "source": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + "

Before you move to Week 2 (which is tons of fun)

\n", + " Please see the week1 EXERCISE notebook for your challenge for the end of week 1. This will give you some essential practice working with Frontier APIs, and prepare you well for Week 2.\n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "17b64f0f-7d33-4493-985a-033d06e8db08", + "metadata": {}, + "source": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + "

A reminder on 3 useful resources

\n", + " 1. The resources for the course are available here.
\n", + " 2. I'm on LinkedIn here and I love connecting with people taking the course!
\n", + " 3. I'm trying out X/Twitter and I'm at @edwarddonner and hoping people will teach me how it's done.. \n", + "
\n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "6f48e42e-fa7a-495f-a5d4-26bfc24d60b6", + "metadata": {}, + "source": [ + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + " \n", + " \n", + "

Finally! I have a special request for you

\n", + " \n", + " My editor tells me that it makes a MASSIVE difference when students rate this course on Udemy - it's one of the main ways that Udemy decides whether to show it to others. If you're able to take a minute to rate this, I'd be so very grateful! And regardless - always please reach out to me at ed@edwarddonner.com if I can help at any point.\n", + " \n", + "
" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.14" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/week1/community-contributions/bharat_puri/my_ai_tutor.ipynb b/week1/community-contributions/bharat_puri/my_ai_tutor.ipynb new file mode 100644 index 0000000..170bc70 --- /dev/null +++ b/week1/community-contributions/bharat_puri/my_ai_tutor.ipynb @@ -0,0 +1,231 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "67159c63-c229-485c-8044-b506c1e17caa", + "metadata": {}, + "source": [ + "# My AI Technical Tutor \n", + "\n", + "## **Author:** Bharat Puri \n", + "\n", + "### Purpose:\n", + "Builds an AI tutor that answers technical questions interactively.\n", + "\n", + "Uses OpenAI GPT-4o-mini to explain topics, remember context, and guide learning.\n", + "Inspired by the Week 1 challenge: create a personalized tutor using GPT or LLaMA.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "d5b08506-dc8b-4443-9201-5f1848161363", + "metadata": {}, + "outputs": [], + "source": [ + "# imports\n", + "# If these fail, please check you're running from an 'activated' environment with (llms) in the command prompt\n", + "\n", + "import os\n", + "import json\n", + "from dotenv import load_dotenv\n", + "from IPython.display import Markdown, display, update_display\n", + "# To handle path of scraper go up 2 directories\n", + "import sys\n", + "sys.path.append(os.path.abspath(os.path.join(\"..\", \"..\"))) \n", + "from openai import OpenAI" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "fc5d8880-f2ee-4c06-af16-ecbc0262af61", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "API key looks good so far\n" + ] + } + ], + "source": [ + "# Initialize and constants\n", + "\n", + "load_dotenv(override=True)\n", + "api_key = os.getenv('OPENAI_API_KEY')\n", + "\n", + "if api_key and api_key.startswith('sk-proj-') and len(api_key)>10:\n", + " print(\"API key looks good so far\")\n", + "else:\n", + " print(\"There might be a problem with your API key? Please visit the troubleshooting notebook!\")\n", + " \n", + "MODEL = 'gpt-5-nano'\n", + "\n", + "openai = OpenAI()" + ] + }, + { + "cell_type": "markdown", + "id": "1771af9c-717a-4fca-bbbe-8a95893312c3", + "metadata": {}, + "source": [ + "## First step: Define system prompt - the tutor personality\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "6957b079-0d96-45f7-a26a-3487510e9b35", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "👋 Welcome to your AI Tutor! Type 'quit' anytime to stop.\n", + "\n" + ] + } + ], + "source": [ + "tutor_system_prompt = \"\"\"\n", + "You are a patient, encouraging AI tutor for technical learners.\n", + "Always connect new answers to previous discussion topics.\n", + "Explain concepts step by step with examples.\n", + "Use Markdown formatting, code snippets, and short summaries.\n", + "End each answer with a friendly question to continue learning.\n", + "\"\"\"\n", + "conversation_history = []\n", + "print(\"👋 Welcome to your AI Tutor! Type 'quit' anytime to stop.\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "0d74128e-dfb6-47ec-9549-288b621c838c", + "metadata": {}, + "source": [ + "## Second step: Main interactive loop (runs in notebook console)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "85a5b6e2-e7ef-44a9-bc7f-59ede71037b5", + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "❓ Your question: Hi, my name is Anika. I am 8 year old and i want to write KPOP daemon hunterX story in brief.\n" + ] + }, + { + "data": { + "text/markdown": [ + "Hi Anika! That sounds like a fantastic story idea! KPOP and daemon hunters make a unique combination. Let’s break it down step-by-step to help you create a brief outline for your story.\n", + "\n", + "### Step 1: Define Your Main Characters\n", + "- **Protagonist**: Is your main character a KPOP idol who discovers they can hunt daemons?\n", + "- **Daemon**: What is a daemon? Is it a creature, a spirit, or something else? \n", + "\n", + "**Example**: \n", + "- **Protagonist**: Jina, a talented KPOP singer.\n", + "- **Daemon**: Shadow, a mischievous spirit that feeds on negative emotions.\n", + "\n", + "### Step 2: Set the Scene\n", + "Where does the story take place?\n", + "- **Place**: In a bustling city filled with fans and concerts, but also hidden magical creatures.\n", + "\n", + "**Example**: The story might unfold in Seoul, South Korea, during a big concert tour where daemons begin to cause chaos.\n", + "\n", + "### Step 3: Create the Conflict\n", + "What challenges will your character face?\n", + "- **Conflict**: Jina must balance her rising fame with the responsibility of hunting the daemons.\n", + "\n", + "**Example**: As her concerts grow larger, the daemons grow bolder, threatening to ruin her performances!\n", + "\n", + "### Step 4: Develop a Resolution\n", + "How does your character overcome the challenges?\n", + "- **Resolution**: Jina could learn to harness her music to calm the daemons, turning them into allies rather than enemies.\n", + "\n", + "**Example**: By using her songs to spread joy, she transforms the negative energy into something beautiful.\n", + "\n", + "### Step 5: Summarize \n", + "Here's a brief summary of your story:\n", + "*In the vibrant world of KPOP, Jina, a rising idol, discovers that she has the unique ability to hunt daemons that threaten her concerts. With her enchanting voice, she learns to turn chaos into harmony, transforming her biggest challenges into her greatest strengths.*\n", + "\n", + "### Friendly Question\n", + "What do you think about this outline? Do you have any ideas for the characters or what Jina's songs could do? Let’s make your story even better!" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "❓ Your question: quit\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "👋 Goodbye, happy learning!\n" + ] + } + ], + "source": [ + "while True:\n", + " user_input = input(\"❓ Your question: \")\n", + " if user_input.lower() in [\"quit\", \"exit\"]:\n", + " print(\"👋 Goodbye, happy learning!\")\n", + " break\n", + "\n", + " conversation_history.append({\"role\": \"user\", \"content\": user_input})\n", + " stream = openai.chat.completions.create(\n", + " model=\"gpt-4o-mini\",\n", + " messages=[{\"role\": \"system\", \"content\": tutor_system_prompt}] + conversation_history,\n", + " stream=True\n", + " )\n", + "\n", + " response = \"\"\n", + " display_handle = display(Markdown(\"\"), display_id=True)\n", + " for chunk in stream:\n", + " response += chunk.choices[0].delta.content or \"\"\n", + " update_display(Markdown(response), display_id=display_handle.display_id)\n", + "\n", + " conversation_history.append({\"role\": \"assistant\", \"content\": response})" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.14" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}