"system_message = \"You are an assistant that is great at telling jokes\"\n",
"system_message = \"You are an assistant that is great at telling jokes\"\n",
"user_prompt = \"Tell a light-hearted joke for an audience of Data Scientists\"\n",
"user_prompt = \"Tell a light-hearted joke for an audience of Data Scientists\"\n",
@ -113,19 +102,10 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "91578b16",
"id": "91578b16",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello Shardul! It's nice to meet you. How can I help you today?\n",
"\n"
]
}
],
"source": [
"source": [
"chat = model.start_chat(history=[])\n",
"chat = model.start_chat(history=[])\n",
"response = chat.send_message('Hello! My name is Shardul.')\n",
"response = chat.send_message('Hello! My name is Shardul.')\n",
@ -134,19 +114,10 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "7c4bc38f",
"id": "7c4bc38f",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Did you know that the iconic lightsaber fight choreography in Star Wars was heavily influenced by Japanese samurai sword fighting styles? Specifically, the movements and stances of the Jedi and Sith were inspired by kendo and other forms of Japanese martial arts. This gives the lightsaber battles a unique elegance and deadly precision that sets them apart from typical sword fights in other films.\n",
"\n"
]
}
],
"source": [
"source": [
"response = chat.send_message('Can you tell something interesting about star wars?')\n",
"response = chat.send_message('Can you tell something interesting about star wars?')\n",
"print(response.text)"
"print(response.text)"
@ -154,19 +125,10 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "337bee91",
"id": "337bee91",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Yes, your name is Shardul.\n",
"\n"
]
}
],
"source": [
"source": [
"response = chat.send_message('Do you remember what my name is?')\n",
"response = chat.send_message('Do you remember what my name is?')\n",
"print(response.text)"
"print(response.text)"
@ -174,44 +136,10 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 34,
"execution_count": null,
"id": "bcaf4d95",
"id": "bcaf4d95",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"data": {
"text/plain": [
"[parts {\n",
" text: \"Hello! My name is Shardul.\"\n",
" }\n",
" role: \"user\",\n",
" parts {\n",
" text: \"Hello Shardul! It\\'s nice to meet you. How can I help you today?\\n\"\n",
" }\n",
" role: \"model\",\n",
" parts {\n",
" text: \"Can you tell something interesting about star wars?\"\n",
" }\n",
" role: \"user\",\n",
" parts {\n",
" text: \"One interesting fact about Star Wars is that the iconic lightsaber sound effect was created by recording the hum of a broken-down projector. The sound designer, Ben Burtt, combined that with the sound of a television\\'s static to create the distinctive whoosh and hum we all know and love. It\\'s a perfect example of how seemingly mundane sounds can be creatively repurposed to create iconic elements of a beloved franchise.\\n\"\n",
" }\n",
" role: \"model\",\n",
" parts {\n",
" text: \"Do you remember what my name is?\"\n",
" }\n",
" role: \"user\",\n",
" parts {\n",
" text: \"Yes, your name is Shardul.\\n\"\n",
" }\n",
" role: \"model\"]"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"source": [
"chat.history"
"chat.history"
]
]
@ -279,37 +207,10 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"id": "f6e745e1",
"id": "f6e745e1",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gen\n",
" AI, short for **Generative AI**, refers to a type of artificial intelligence\n",
" that can create new content, rather than just analyzing or classifying existing data. \n",
"* **Images:** Generating realistic or stylized images from text descriptions (prompts). Examples include DALL-E \n",
"2, Midjourney, and Stable Diffusion.\n",
"* **Audio:** Creating music, sound effects, and voiceovers. Examples include Amper Music and Jukebox.\n",
"* **Video:** Generating short video clips. This is a\n",
" rapidly developing area.\n",
"* **3D models:** Creating three-dimensional objects and scenes.\n",
"\n",
"Gen AI achieves this by learning patterns and structures from massive datasets and then using this knowledge to generate new, similar but unique outputs. The\n",
" underlying techniques often involve deep learning models, particularly those based on neural networks like transformers, autoencoders, and generative adversarial networks (GANs).\n",
"\n",
"In essence, Gen AI moves beyond simply processing information to actively *producing* it, opening up exciting possibilities in various fields, but also raising ethical and societal concerns about misinformation\n",
"/opt/homebrew/Caskroom/miniconda/base/envs/llms/lib/python3.11/site-packages/gradio/components/chatbot.py:248: UserWarning: The 'tuples' format for chatbot messages is deprecated and will be removed in a future version of Gradio. Please set type='messages' instead, which uses openai-style 'role' and 'content' keys.\n",
" warnings.warn(\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"* Running on local URL: http://127.0.0.1:7870\n",
"\n",
"To create a public link, set `share=True` in `launch()`.\n"