Merge branch 'main' into SD_enhancements
This commit is contained in:
@@ -11,7 +11,13 @@
|
||||
"\n",
|
||||
"Our goal is to code a new kind of Web Browser. Give it a URL, and it will respond with a summary. The Reader's Digest of the internet!!\n",
|
||||
"\n",
|
||||
"Before starting, be sure to have followed the instructions in the \"README\" file, including creating your API key with OpenAI and adding it to the `.env` file."
|
||||
"Before starting, be sure to have followed the instructions in the \"README\" file, including creating your API key with OpenAI and adding it to the `.env` file.\n",
|
||||
"\n",
|
||||
"## If you're new to Jupyer Lab\n",
|
||||
"\n",
|
||||
"Welcome to the wonderful world of Data Science experimentation! Once you've used Jupyter Lab, you'll wonder how you ever lived without it. Simply click in each \"cell\" with code in it, like the cell immediately below this text, and hit Shift+Return to execute that cell. As you wish, you can add a cell with the + button in the toolbar, and print values of variables, or try out variations.\n",
|
||||
"\n",
|
||||
"If you need to start again, go to Kernel menu >> Restart kernel."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -40,11 +46,16 @@
|
||||
"\n",
|
||||
"The next cell is where we load in the environment variables in your `.env` file and connect to OpenAI.\n",
|
||||
"\n",
|
||||
"Troubleshooting if you have problems:\n",
|
||||
"## Troubleshooting if you have problems:\n",
|
||||
"\n",
|
||||
"1. OpenAI takes a few minutes to register after you set up an account. If you receive an error about being over quota, try waiting a few minutes and try again.\n",
|
||||
"2. As a fallback, replace the line `openai = OpenAI()` with `openai = OpenAI(api_key=\"your-key-here\")` - while it's not recommended to hard code tokens in Jupyter lab, because then you can't share your lab with others, it's a workaround for now\n",
|
||||
"3. Contact me! Message me or email ed@edwarddonner.com and we will get this to work.\n",
|
||||
"2. Also, double check you have the right kind of API token with the right permissions. You should find it on [this webpage](https://platform.openai.com/api-keys) and it should show with Permissions of \"All\". If not, try creating another key by:\n",
|
||||
"- Pressing \"Create new secret key\" on the top right\n",
|
||||
"- Select **Owned by:** you, **Project:** Default project, **Permissions:** All\n",
|
||||
"- Click Create secret key, and use that new key in the code and the `.env` file (it might take a few minutes to activate)\n",
|
||||
"- Do a Kernel >> Restart kernel, and execute the cells in this Jupyter lab starting at the top\n",
|
||||
"4. As a fallback, replace the line `openai = OpenAI()` with `openai = OpenAI(api_key=\"your-key-here\")` - while it's not recommended to hard code tokens in Jupyter lab, because then you can't share your lab with others, it's a workaround for now\n",
|
||||
"5. Contact me! Message me or email ed@edwarddonner.com and we will get this to work.\n",
|
||||
"\n",
|
||||
"Any concerns about API costs? See my notes in the README - costs should be minimal, and you can control it at every point."
|
||||
]
|
||||
@@ -396,84 +407,14 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"id": "49c4315f-340b-4371-b6cd-2a772f4b7bdd",
|
||||
"cell_type": "markdown",
|
||||
"id": "36ed9f14-b349-40e9-a42c-b367e77f8bda",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/markdown": [
|
||||
"# Summary of Visit Singapore Official Site\n",
|
||||
"\n",
|
||||
"The **Visit Singapore Official Site** serves as a comprehensive guide for tourists and locals eager to explore the myriad attractions that Singapore has to offer. The website features detailed information on various categories including:\n",
|
||||
"\n",
|
||||
"- **Top Attractions**: Highlights of popular places to visit, such as Gardens by the Bay, Sentosa Island, and Universal Studios Singapore.\n",
|
||||
"- **Cultural Experiences**: Insights into Singapore's diverse heritage and cultural festivals.\n",
|
||||
"- **Dining Options**: Recommendations for local cuisine, hawker centers, and fine dining establishments.\n",
|
||||
"- **Shopping**: Guides on where to shop, including famous shopping streets and malls.\n",
|
||||
"- **Events and Festivals**: Information on upcoming events and annual festivals that showcase Singapore’s vibrant lifestyle.\n",
|
||||
"\n",
|
||||
"The site also emphasizes the city’s safety and cleanliness, making it an appealing destination for travelers.\n",
|
||||
"\n",
|
||||
"### News and Announcements\n",
|
||||
"No specific news or announcements were highlighted in the provided content."
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Markdown object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"display_summary(\"https://www.visitsingapore.com\")"
|
||||
"## An extra exercise for those who enjoy web scraping\n",
|
||||
"\n",
|
||||
"You may notice that if you try `display_summary(\"https://openai.com\")` - it doesn't work! That's because OpenAI has a fancy website that uses Javascript. There are many ways around this that some of you might be familiar with. For example, Selenium is a hugely popular framework that runs a browser behind the scenes, renders the page, and allows you to query it. If you have experience with Selenium, Playwright or similar, then feel free to improve the Website class to use them. Please push your code afterwards so I can share it with other students!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"id": "7586494d-d2d7-4e08-952b-b07420b12edc",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/markdown": [
|
||||
"# Gardens by the Bay - Summary\n",
|
||||
"\n",
|
||||
"Gardens by the Bay is a premier horticultural attraction located in the heart of Singapore, renowned for its diverse collection of over 1.5 million plants from around the world, excluding Antarctica. The site features iconic structures and attractions such as the Flower Dome, Cloud Forest, OCBC Skyway, and Supertree Observatory, creating a unique blend of nature and architecture.\n",
|
||||
"\n",
|
||||
"## Highlights\n",
|
||||
"- **Attractions**: Visitors can explore various themed conservatories, interact with art sculptures, and enjoy panoramic views from the Skyway.\n",
|
||||
"- **Events**: Noteworthy upcoming events include the \"Carnival of Flowers\" running from September 23 to November 17, 2024, and seasonal craft activities in the Flower Dome.\n",
|
||||
"- **Sustainability**: The gardens emphasize sustainability through innovative architecture and eco-friendly practices.\n",
|
||||
"\n",
|
||||
"## Promotions and Membership\n",
|
||||
"- Current promotions include a 15% discount on Friends of the Gardens membership for DBS/POSB cardholders until October 31, 2024, and ongoing deals for dining within the attraction.\n",
|
||||
"- A chance to win air tickets to Europe is offered for new Friends of the Gardens members from September 1, 2024, to May 31, 2025.\n",
|
||||
"\n",
|
||||
"The website serves as a comprehensive guide for planning visits, offers educational resources for schools, and encourages engagement through social media platforms."
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Markdown object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"display_summary(\"https://www.gardensbythebay.com.sg/\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "79f8471d-46a7-4250-a550-dab379bb9263",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user