diff --git a/week1/day1.ipynb b/week1/day1.ipynb index 349ad9e..0aad0d2 100644 --- a/week1/day1.ipynb +++ b/week1/day1.ipynb @@ -478,7 +478,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "llms", "language": "python", "name": "python3" }, @@ -492,7 +492,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.11.10" } }, "nbformat": 4, diff --git a/week2/day1.ipynb b/week2/day1.ipynb index fe515bc..348076e 100644 --- a/week2/day1.ipynb +++ b/week2/day1.ipynb @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "de23bb9e-37c5-4377-9a82-d7b6c648eeb6", "metadata": {}, "outputs": [], @@ -602,7 +602,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "llms", "language": "python", "name": "python3" }, @@ -616,7 +616,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.11" + "version": "3.11.10" } }, "nbformat": 4, diff --git a/week2/day2.ipynb b/week2/day2.ipynb index bf5367f..03949e8 100644 --- a/week2/day2.ipynb +++ b/week2/day2.ipynb @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "c44c5494-950d-4d2f-8d4f-b87b57c5b330", "metadata": {}, "outputs": [], @@ -35,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "d1715421-cead-400b-99af-986388a97aff", "metadata": {}, "outputs": [], @@ -45,10 +45,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "337d5dfc-0181-4e3b-8ab9-e78e0c3f657b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "OpenAI API Key exists and begins sk-proj-\n", + "Anthropic API Key not set\n", + "Google API Key not set\n" + ] + } + ], "source": [ "# Load environment variables in a file called .env\n", "# Print the key prefixes to help with any debugging\n", @@ -76,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "22586021-1795-4929-8079-63f5bb4edd4c", "metadata": {}, "outputs": [], @@ -85,14 +95,14 @@ "\n", "openai = OpenAI()\n", "\n", - "claude = anthropic.Anthropic()\n", + "# claude = anthropic.Anthropic()\n", "\n", - "google.generativeai.configure()" + "# google.generativeai.configure()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "b16e6021-6dc4-4397-985a-6679d6c8ffd5", "metadata": {}, "outputs": [], @@ -104,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "02ef9b69-ef31-427d-86d0-b8c799e1c1b1", "metadata": {}, "outputs": [], @@ -125,10 +135,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "aef7d314-2b13-436b-b02d-8de3b72b193f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "\"Today's date is October 1, 2023.\"" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "message_gpt(\"What is today's date?\")" ] @@ -143,7 +164,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "bc664b7a-c01d-4fea-a1de-ae22cdd5141a", "metadata": {}, "outputs": [], @@ -157,20 +178,68 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "083ea451-d3a0-4d13-b599-93ed49b975e4", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Shout has been called with input hello\n" + ] + }, + { + "data": { + "text/plain": [ + "'HELLO'" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "shout(\"hello\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "08f1f15a-122e-4502-b112-6ee2817dda32", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on local URL: http://127.0.0.1:7860\n", + "\n", + "To create a public link, set `share=True` in `launch()`.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# The simplicty of gradio. This might appear in \"light mode\" - I'll show you how to make this in dark mode later.\n", "\n", @@ -179,10 +248,48 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "c9a359a4-685c-4c99-891c-bb4d1cb7f426", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on local URL: http://127.0.0.1:7861\n", + "* Running on public URL: https://2446dac02d10f0eeb6.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Shout has been called with input karam\n" + ] + } + ], "source": [ "# Adding share=True means that it can be accessed publically\n", "# A more permanent hosting is available using a platform called Spaces from HuggingFace, which we will touch on next week\n", @@ -193,10 +300,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "cd87533a-ff3a-4188-8998-5bedd5ba2da3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on local URL: http://127.0.0.1:7865\n", + "\n", + "Could not create share link. Please check your internet connection or our status page: https://status.gradio.app.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Adding inbrowser=True opens up a new browser window automatically\n", "\n", @@ -254,10 +391,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "f235288e-63a2-4341-935b-1441f9be969b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on local URL: http://127.0.0.1:7862\n", + "\n", + "To create a public link, set `share=True` in `launch()`.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# And now - changing the function from \"shout\" to \"message_gpt\"\n", "\n", @@ -272,10 +439,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "af9a3262-e626-4e4b-80b0-aca152405e63", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on local URL: http://127.0.0.1:7863\n", + "\n", + "To create a public link, set `share=True` in `launch()`.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Let's use Markdown\n", "# Are you wondering why it makes any difference to set system_message when it's not referred to in the code below it?\n", @@ -295,7 +492,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "88c04ebf-0671-4fea-95c9-bc1565d4bb4f", "metadata": {}, "outputs": [], @@ -322,10 +519,41 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "0bb1f789-ff11-4cba-ac67-11b815e29d09", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "* Running on local URL: http://127.0.0.1:7864\n", + "* Running on public URL: https://8d928a85414ef00ff6.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "view = gr.Interface(\n", " fn=stream_gpt,\n", @@ -333,7 +561,7 @@ " outputs=[gr.Markdown(label=\"Response:\")],\n", " flagging_mode=\"never\"\n", ")\n", - "view.launch()" + "view.launch(share=True)" ] }, { @@ -552,7 +780,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "venv", "language": "python", "name": "python3" }, @@ -566,7 +794,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.11" + "version": "3.11.4" } }, "nbformat": 4,