Merge branch 'ed-donner:main' into community-contributions-branch
This commit is contained in:
344
community-contributions/clinic_booking_bot.ipynb
Normal file
344
community-contributions/clinic_booking_bot.ipynb
Normal file
@@ -0,0 +1,344 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 170,
|
||||
"id": "a1aa1b43-7a47-4aca-ae5f-94a9d4ba2d89",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## Clinic Booking Bot\n",
|
||||
"\n",
|
||||
"##Easily book your clinic visit – available only on weekdays between **14:00 and 15:00**. \n",
|
||||
"##Speak or type, and get instant confirmation.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 171,
|
||||
"id": "fe798c6a-f8da-46aa-8c0e-9d2623def3d2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# import library\n",
|
||||
"\n",
|
||||
"import os\n",
|
||||
"import json\n",
|
||||
"from dotenv import load_dotenv\n",
|
||||
"from openai import OpenAI\n",
|
||||
"import gradio as gr\n",
|
||||
"import base64\n",
|
||||
"from io import BytesIO\n",
|
||||
"from datetime import date\n",
|
||||
"from PIL import Image, ImageDraw, ImageFont\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 172,
|
||||
"id": "0ad4e526-e95d-4e70-9faa-b4236b105dd5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"OpenAI API Key exists and begins sk-proj-\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Save keys\n",
|
||||
"\n",
|
||||
"load_dotenv(override=True)\n",
|
||||
"\n",
|
||||
"openai_api_key = os.getenv('OPENAI_API_KEY')\n",
|
||||
"if openai_api_key:\n",
|
||||
" print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n",
|
||||
"else:\n",
|
||||
" print(\"OpenAI API Key not set\")\n",
|
||||
" \n",
|
||||
"MODEL = \"gpt-4o-mini\"\n",
|
||||
"openai = OpenAI()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 173,
|
||||
"id": "ae95308e-0002-4017-9f2c-fcb1ddb248fa",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# --- CONFIG ---\n",
|
||||
"BOOKING_START = 14\n",
|
||||
"BOOKING_END = 15\n",
|
||||
"WEEKDAYS = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\"]\n",
|
||||
"PHONE = \"010-1234567\"\n",
|
||||
"confirmed_bookings = []\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 174,
|
||||
"id": "e21b0fd0-4cda-4938-8867-dc2c6e7af4b1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# --- TTS ---\n",
|
||||
"def generate_tts(text, voice=\"fable\", filename=\"output.mp3\"):\n",
|
||||
" response = openai.audio.speech.create(\n",
|
||||
" model=\"tts-1\",\n",
|
||||
" voice=\"fable\",\n",
|
||||
" input=text\n",
|
||||
" )\n",
|
||||
" with open(filename, \"wb\") as f:\n",
|
||||
" f.write(response.content)\n",
|
||||
" return filename"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 175,
|
||||
"id": "e28a5c3b-bd01-4845-a41e-87823f6bb078",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# --- Translate Booking Confirmation ---\n",
|
||||
"def translate_text(text, target_language=\"nl\"):\n",
|
||||
" prompt = f\"Translate this message to {target_language}:\\n{text}\"\n",
|
||||
" response = openai.chat.completions.create(\n",
|
||||
" model=\"gpt-4\",\n",
|
||||
" messages=[\n",
|
||||
" {\"role\": \"system\", \"content\": \"You are a helpful translator.\"},\n",
|
||||
" {\"role\": \"user\", \"content\": prompt}\n",
|
||||
" ]\n",
|
||||
" )\n",
|
||||
" return response.choices[0].message.content.strip()\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 176,
|
||||
"id": "8ed57cc9-7d54-4a5d-831b-0efcc5b7a7a9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# --- Booking Logic ---\n",
|
||||
"def book_appointment(name, time_str):\n",
|
||||
" try:\n",
|
||||
" booking_time = datetime.strptime(time_str, \"%H:%M\")\n",
|
||||
" except ValueError:\n",
|
||||
" return \"Invalid time format. Use HH:MM.\", None, None\n",
|
||||
"\n",
|
||||
" hour = booking_time.hour\n",
|
||||
" weekday = datetime.today().strftime(\"%A\")\n",
|
||||
"\n",
|
||||
" if weekday not in WEEKDAYS:\n",
|
||||
" response = \"Bookings are only available on weekdays.\"\n",
|
||||
" elif BOOKING_START <= hour < BOOKING_END:\n",
|
||||
" confirmation = f\"Booking confirmed for {name} at {time_str}.\"\n",
|
||||
" confirmed_bookings.append((name, time_str))\n",
|
||||
" translated = translate_text(confirmation)\n",
|
||||
" audio = generate_tts(translated)\n",
|
||||
" image = generate_booking_image(name, time_str)\n",
|
||||
" return translated, audio, image\n",
|
||||
" else:\n",
|
||||
" response = \"Sorry, bookings are only accepted between 14:00 and 15:00 on weekdays.\"\n",
|
||||
" translated = translate_text(response)\n",
|
||||
" audio = generate_tts(translated)\n",
|
||||
" return translated, audio, None"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 177,
|
||||
"id": "19b52115-f0f3-4d63-a463-886163d4cfd1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# --- Booking Card ---\n",
|
||||
"def generate_booking_image(name, time_str):\n",
|
||||
" img = Image.new(\"RGB\", (500, 250), color=\"white\")\n",
|
||||
" draw = ImageDraw.Draw(img)\n",
|
||||
" msg = f\"\\u2705 Booking Confirmed\\nName: {name}\\nTime: {time_str}\"\n",
|
||||
" draw.text((50, 100), msg, fill=\"black\")\n",
|
||||
" return img"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 178,
|
||||
"id": "2c446b6c-d410-4ba1-b0c7-c475e5259ff5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# --- Voice Booking ---\n",
|
||||
"def voice_booking(audio_path, name):\n",
|
||||
" with open(audio_path, \"rb\") as f:\n",
|
||||
" response = openai.audio.transcriptions.create(model=\"whisper-1\", file=f)\n",
|
||||
" transcription = response.text.strip()\n",
|
||||
"\n",
|
||||
" system_prompt = \"\"\"\n",
|
||||
" You are a clinic assistant. Extract only the appointment time from the user's sentence in 24-hour HH:MM format.\n",
|
||||
" If no time is mentioned, respond with 'No valid time found.'\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" response = openai.chat.completions.create(\n",
|
||||
" model=\"gpt-4\",\n",
|
||||
" messages=[\n",
|
||||
" {\"role\": \"system\", \"content\": system_prompt},\n",
|
||||
" {\"role\": \"user\", \"content\": transcription}\n",
|
||||
" ]\n",
|
||||
" )\n",
|
||||
" extracted_time = response.choices[0].message.content.strip()\n",
|
||||
"\n",
|
||||
" if \":\" in extracted_time:\n",
|
||||
" return book_appointment(name, extracted_time)\n",
|
||||
" else:\n",
|
||||
" message = \"Sorry, I couldn't understand the time. Please try again.\"\n",
|
||||
" translated = translate_text(message)\n",
|
||||
" audio_path = generate_tts(translated)\n",
|
||||
" return translated, audio_path, None"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 179,
|
||||
"id": "121d2907-7fa8-4248-b2e7-83617ea66ff0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# --- Chat Bot Handler ---\n",
|
||||
"def chat_bot(messages):\n",
|
||||
" system_prompt = \"\"\"\n",
|
||||
" You are a clinic booking assistant. Your job is to:\n",
|
||||
" - Greet the patient and explain your role\n",
|
||||
" - Only assist with making appointments\n",
|
||||
" - Accept bookings only on weekdays between 14:00 and 15:00\n",
|
||||
" - Do not provide medical advice\n",
|
||||
" - Always respond with empathy and clarity\n",
|
||||
" \"\"\"\n",
|
||||
" response = openai.chat.completions.create(\n",
|
||||
" model=\"gpt-4\",\n",
|
||||
" messages=[{\"role\": \"system\", \"content\": system_prompt}] + messages\n",
|
||||
" )\n",
|
||||
" reply = response.choices[0].message.content.strip()\n",
|
||||
" audio = generate_tts(reply)\n",
|
||||
" return reply, audio"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 180,
|
||||
"id": "2427b694-8c57-40cb-b202-4a8989547925",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"* Running on local URL: http://127.0.0.1:7898\n",
|
||||
"* To create a public link, set `share=True` in `launch()`.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div><iframe src=\"http://127.0.0.1:7898/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.HTML object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Gradio interface\n",
|
||||
"with gr.Blocks(theme=gr.themes.Soft()) as demo:\n",
|
||||
" gr.Markdown(\"\"\"## 🩺 GP Booking Assistant \n",
|
||||
"Only available weekdays between **14:00 and 15:00** \n",
|
||||
"☎️ Contact: {PHONE}\n",
|
||||
"---\"\"\")\n",
|
||||
"\n",
|
||||
" name_global = gr.Textbox(label=\"Your Name\", placeholder=\"Enter your name\", interactive=True)\n",
|
||||
"\n",
|
||||
" with gr.Tab(\"💬 Chat Mode\"):\n",
|
||||
" chatbot = gr.Chatbot(label=\"Booking Chat\", type=\"messages\", height=400)\n",
|
||||
" text_input = gr.Textbox(label=\"Type your message or use your voice below\")\n",
|
||||
" audio_input = gr.Audio(type=\"filepath\", label=\"🎙️ Or speak your request\")\n",
|
||||
" chat_audio_output = gr.Audio(label=\"🔊 Assistant's Reply\", type=\"filepath\")\n",
|
||||
" send_btn = gr.Button(\"Send\")\n",
|
||||
"\n",
|
||||
" def handle_chat(user_message, chat_history):\n",
|
||||
" chat_history = chat_history or []\n",
|
||||
" chat_history.append({\"role\": \"user\", \"content\": user_message})\n",
|
||||
" reply, audio = chat_bot(chat_history)\n",
|
||||
" chat_history.append({\"role\": \"assistant\", \"content\": reply})\n",
|
||||
" return chat_history, \"\", audio\n",
|
||||
"\n",
|
||||
" def handle_audio_chat(audio_path, chat_history):\n",
|
||||
" with open(audio_path, \"rb\") as f:\n",
|
||||
" transcription = openai.audio.transcriptions.create(model=\"whisper-1\", file=f).text.strip()\n",
|
||||
" return handle_chat(transcription, chat_history)\n",
|
||||
"\n",
|
||||
" send_btn.click(handle_chat, [text_input, chatbot], [chatbot, text_input, chat_audio_output])\n",
|
||||
" text_input.submit(handle_chat, [text_input, chatbot], [chatbot, text_input, chat_audio_output])\n",
|
||||
" audio_input.change(handle_audio_chat, [audio_input, chatbot], [chatbot, text_input, chat_audio_output])\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
" with gr.Tab(\"📝 Text Booking\"):\n",
|
||||
" time_text = gr.Textbox(label=\"Preferred Time (HH:MM)\", placeholder=\"e.g., 14:30\")\n",
|
||||
" btn_text = gr.Button(\"📅 Book via Text\")\n",
|
||||
"\n",
|
||||
" with gr.Tab(\"🎙️ Voice Booking\"):\n",
|
||||
" voice_input = gr.Audio(type=\"filepath\", label=\"Say your preferred time\")\n",
|
||||
" btn_voice = gr.Button(\"📅 Book via Voice\")\n",
|
||||
"\n",
|
||||
" output_text = gr.Textbox(label=\"Response\", interactive=False)\n",
|
||||
" output_audio = gr.Audio(label=\"Audio Reply\", type=\"filepath\")\n",
|
||||
" output_image = gr.Image(label=\"Booking Confirmation\")\n",
|
||||
"\n",
|
||||
" btn_text.click(fn=book_appointment, inputs=[name_global, time_text], outputs=[output_text, output_audio, output_image])\n",
|
||||
" btn_voice.click(fn=voice_booking, inputs=[voice_input, name_global], outputs=[output_text, output_audio, output_image])\n",
|
||||
"\n",
|
||||
" gr.Markdown(\"\"\"---\n",
|
||||
"<small>This assistant does **not** give medical advice. It only books appointments within allowed hours.</small>\n",
|
||||
"\"\"\")\n",
|
||||
"\n",
|
||||
" demo.launch()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f359de0a-28b1-4895-b21d-91d79e494a0d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# 🧠 Agentic Voice/Text Support Chatbot
|
||||
|
||||
A multimodal chatbot interface with support for **text and voice input**, **multiple large language models (LLMs)**, and **context memory persistence** — all in a single Gradio-based GUI.
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- 🔄 **Multi-LLM switching**: Dynamically switch between OpenAI, Anthropic Claude, and Meta LLaMA (via Ollama)
|
||||
- 🎤 **Voice input**: Use your microphone with live speech-to-text transcription
|
||||
- 💬 **Contextual memory**: Maintain chat history even when switching models
|
||||
- 🧪 **Prototype-ready**: Built with Gradio for rapid GUI testing and development
|
||||
|
||||
## 🛠️ Technologies Used
|
||||
|
||||
- [Gradio](https://www.gradio.app/) – GUI interface
|
||||
- [OpenAI API](https://platform.openai.com/)
|
||||
- [Anthropic Claude API](https://www.anthropic.com/)
|
||||
- [Ollama](https://ollama.com/) – Local LLaMA inference
|
||||
- [`speech_recognition`](https://pypi.org/project/SpeechRecognition/) – Voice-to-text
|
||||
- `sounddevice`, `numpy` – Audio recording
|
||||
- `.env` – Environment variable management
|
||||
|
||||
## You’ll also need:
|
||||
- API keys for OpenAI and Claude
|
||||
- Ollama installed locally to run LLaMA models
|
||||
- A .env file with the necessary API keys
|
||||
@@ -0,0 +1,395 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d006b2ea-9dfe-49c7-88a9-a5a0775185fd",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Building a Chatbot Interface, with Text or Voice Input, Multi-LLM support, and Memory Persistence"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "eeb20b3e",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"In this tutorial, we’ll use Gradio to build a simple chatbot prototype with a user-friendly interface. The chatbot will support multiple language models, allowing the user to switch models at any point during the conversation. It will also offer optional memory persistence, where the chat history is stored and forwarded to the selected model — which allows shared memory across models, even when switching mid-chat.\n",
|
||||
"\n",
|
||||
"In this project, we'll use OpenAI's API, Anthropic's Claude, and Meta's LLaMA, which runs locally via an Ollama server. Additionally, we'll use Python’s speech_recognition module to convert speech to text.\n",
|
||||
"\n",
|
||||
"It's worth noting that some APIs — such as OpenAI's — now support direct audio input, so integrating speech capabilities can also be done end-to-end without a separate transcription module."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 37,
|
||||
"id": "a07e7793-b8f5-44f4-aded-5562f633271a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import requests\n",
|
||||
"from dotenv import load_dotenv\n",
|
||||
"from openai import OpenAI\n",
|
||||
"import anthropic"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 38,
|
||||
"id": "a0a343b1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Speech recording and recognition libraries\n",
|
||||
"import speech_recognition as sr\n",
|
||||
"import sounddevice as sd\n",
|
||||
"import numpy as np"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 39,
|
||||
"id": "d7693eda",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# GUI prototyping\n",
|
||||
"import gradio as gr"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 40,
|
||||
"id": "41ffc0e6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"buffer = [] # For temporarily holding sound recording\n",
|
||||
"\n",
|
||||
"# Helper function for handling voice recording\n",
|
||||
"def callback(indata, frames, time, status):\n",
|
||||
" buffer.append(indata.copy())\n",
|
||||
"\n",
|
||||
"stream = sd.InputStream(callback=callback, samplerate=16000, channels=1, dtype='int16')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 41,
|
||||
"id": "e9a79075",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"# Function for handling recording data and status\n",
|
||||
"def toggle_recording(state):\n",
|
||||
" global stream, buffer\n",
|
||||
" print('state', state)\n",
|
||||
"\n",
|
||||
" if not state:\n",
|
||||
" buffer.clear()\n",
|
||||
" stream.start()\n",
|
||||
" return gr.update(value=\"Stop Recording\"), 'Recording...', not state\n",
|
||||
" else:\n",
|
||||
" stream.stop()\n",
|
||||
" audio = np.concatenate(buffer, axis=0)\n",
|
||||
" text = transcribe(audio)\n",
|
||||
" return gr.update(value=\"Start Recording\"), text, not state\n",
|
||||
"\n",
|
||||
"# Functio that converts speech to text via Google's voice recognition module\n",
|
||||
"def transcribe(recording, sample_rate=16000):\n",
|
||||
" r = sr.Recognizer()\n",
|
||||
"\n",
|
||||
" # Convert NumPy array to AudioData\n",
|
||||
" audio_data = sr.AudioData(\n",
|
||||
" recording.tobytes(), # Raw byte data\n",
|
||||
" sample_rate, # Sample rate\n",
|
||||
" 2 # Sample width in bytes (16-bit = 2 bytes)\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" text = r.recognize_google(audio_data)\n",
|
||||
" print(\"You said:\", text)\n",
|
||||
" return text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "dcfb0190",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### LLM & API set-up"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "59416453",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"##### Load API keys from .env"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 42,
|
||||
"id": "b638b822",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"OpenAI API Key exists and begins sk-proj-\n",
|
||||
"Anthropic API Key exists and begins sk-ant-\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",
|
||||
"\n",
|
||||
"load_dotenv(override=True)\n",
|
||||
"openai_api_key = os.getenv('OPENAI_API_KEY')\n",
|
||||
"anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n",
|
||||
"google_api_key = os.getenv('GOOGLE_API_KEY')\n",
|
||||
"\n",
|
||||
"if openai_api_key:\n",
|
||||
" print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n",
|
||||
"else:\n",
|
||||
" print(\"OpenAI API Key not set\")\n",
|
||||
" \n",
|
||||
"if anthropic_api_key:\n",
|
||||
" print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n",
|
||||
"else:\n",
|
||||
" print(\"Anthropic API Key not set\")\n",
|
||||
"\n",
|
||||
"if google_api_key:\n",
|
||||
" print(f\"Google API Key exists and begins {google_api_key[:8]}\")\n",
|
||||
"else:\n",
|
||||
" print(\"Google API Key not set\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9e6ae162",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Class for handling API calls and routing requests to the selected models"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 43,
|
||||
"id": "268ea65d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class LLMHandler:\n",
|
||||
" def __init__(self, system_message: str = '', ollama_api:str='http://localhost:11434/api/chat'):\n",
|
||||
" # Default system message if none provided\n",
|
||||
" self.system_message = system_message if system_message else \"You are a helpful assistant. Always reply in Markdown\"\n",
|
||||
" self.message_history = []\n",
|
||||
"\n",
|
||||
" # Initialize LLM clients\n",
|
||||
" self.openai = OpenAI()\n",
|
||||
" self.claude = anthropic.Anthropic()\n",
|
||||
" self.OLLAMA_API = ollama_api\n",
|
||||
" self.OLLAMA_HEADERS = {\"Content-Type\": \"application/json\"}\n",
|
||||
"\n",
|
||||
" def llm_call(self, model: str = 'gpt-4o-mini', prompt: str = '', memory_persistence=True):\n",
|
||||
" if not model:\n",
|
||||
" return 'No model specified'\n",
|
||||
"\n",
|
||||
" # Use full message template with system prompt if no prior history\n",
|
||||
" message = self.get_message_template(prompt, initial=True) if (\n",
|
||||
" not self.message_history and not 'claude' in model\n",
|
||||
" ) else self.get_message_template(prompt)\n",
|
||||
"\n",
|
||||
" # Handle memory persistence\n",
|
||||
" if memory_persistence:\n",
|
||||
" self.message_history.extend(message)\n",
|
||||
" else:\n",
|
||||
" self.message_history = message\n",
|
||||
"\n",
|
||||
" # Model-specific dispatch\n",
|
||||
" try:\n",
|
||||
" if 'gpt' in model:\n",
|
||||
" response = self.call_openai(model=model)\n",
|
||||
" elif 'claude' in model:\n",
|
||||
" response = self.call_claude(model=model)\n",
|
||||
" elif 'llama' in model:\n",
|
||||
" response = self.call_ollama(model=model)\n",
|
||||
" else:\n",
|
||||
" response = f'{model.title()} is not supported or not a valid model name.'\n",
|
||||
" except Exception as e:\n",
|
||||
" response = f'Failed to retrieve response. Reason: {e}'\n",
|
||||
"\n",
|
||||
" # Save assistant's reply to history if memory is enabled\n",
|
||||
" if memory_persistence:\n",
|
||||
" self.message_history.append({\n",
|
||||
" \"role\": \"assistant\",\n",
|
||||
" \"content\": response\n",
|
||||
" })\n",
|
||||
"\n",
|
||||
" return response\n",
|
||||
"\n",
|
||||
" def get_message_template(self, prompt: str = '', initial=False):\n",
|
||||
" # Returns a message template with or without system prompt\n",
|
||||
" initial_template = [\n",
|
||||
" {\"role\": \"system\", \"content\": self.system_message},\n",
|
||||
" {\"role\": \"user\", \"content\": prompt}\n",
|
||||
" ]\n",
|
||||
" general_template = [\n",
|
||||
" {\"role\": \"user\", \"content\": prompt}\n",
|
||||
" ]\n",
|
||||
" return initial_template if initial else general_template\n",
|
||||
"\n",
|
||||
" def call_openai(self, model: str = 'gpt-4o-mini'):\n",
|
||||
" # Sends chat completion request to OpenAI API\n",
|
||||
" completion = self.openai.chat.completions.create(\n",
|
||||
" model=model,\n",
|
||||
" messages=self.message_history,\n",
|
||||
" )\n",
|
||||
" response = completion.choices[0].message.content\n",
|
||||
" return response\n",
|
||||
"\n",
|
||||
" def call_ollama(self, model: str = \"llama3.2\"):\n",
|
||||
"\n",
|
||||
" payload = {\n",
|
||||
" \"model\": model,\n",
|
||||
" \"messages\": self.message_history,\n",
|
||||
" \"stream\": False\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" response = requests.post(url=self.OLLAMA_API, headers=self.OLLAMA_HEADERS, json=payload)\n",
|
||||
" return response.json()[\"message\"][\"content\"]\n",
|
||||
"\n",
|
||||
" def call_claude(self, model: str = \"claude-3-haiku-20240307\"):\n",
|
||||
" # Sends chat request to Anthropic Claude API\n",
|
||||
" message = self.claude.messages.create(\n",
|
||||
" model=model,\n",
|
||||
" system=self.system_message,\n",
|
||||
" messages=self.message_history,\n",
|
||||
" max_tokens=500\n",
|
||||
" )\n",
|
||||
" response = message.content[0].text\n",
|
||||
" return response\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 44,
|
||||
"id": "632e618b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"llm_handler = LLMHandler()\n",
|
||||
"\n",
|
||||
"# Function to handle user prompts received by the interface\n",
|
||||
"def llm_call(model, prompt, memory_persistence):\n",
|
||||
" response = llm_handler.llm_call(model=model, prompt=prompt, memory_persistence=memory_persistence)\n",
|
||||
" return response, ''\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 45,
|
||||
"id": "e19228f6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Specify available model names for the dropdown component\n",
|
||||
"AVAILABLE_MODELS = [\"gpt-4\", \"gpt-3.5\", \"claude-3-haiku-20240307\", \"llama3.2\", \"gpt-4o-mini\"]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 46,
|
||||
"id": "f65f43ff",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"* Running on local URL: http://127.0.0.1:7868\n",
|
||||
"* To create a public link, set `share=True` in `launch()`.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div><iframe src=\"http://127.0.0.1:7868/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.HTML object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"execution_count": 46,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"with gr.Blocks() as demo:\n",
|
||||
" state = gr.State(False) # Recording state (on/off)\n",
|
||||
" with gr.Row():\n",
|
||||
" \n",
|
||||
" with gr.Column():\n",
|
||||
" out = gr.Markdown(label='Message history')\n",
|
||||
" with gr.Row():\n",
|
||||
" memory = gr.Checkbox(label='Toggle memory', value=True) # Handle memory status (on/off) btn\n",
|
||||
" model_choice = gr.Dropdown(label='Model', choices=AVAILABLE_MODELS, interactive=True) # Model selection dropdown\n",
|
||||
" query_box = gr.Textbox(label='ChatBox', placeholder=\"Your message\")\n",
|
||||
" record_btn = gr.Button(value='Record voice message') # Start/stop recording btn\n",
|
||||
" send_btn = gr.Button(\"Send\") # Send prompt btn\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" \n",
|
||||
" record_btn.click(fn=toggle_recording, inputs=state, outputs=[record_btn, query_box, state])\n",
|
||||
" send_btn.click(fn=llm_call, inputs=[model_choice, query_box, memory], outputs=[out, query_box])\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"demo.launch()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "3743db5d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "general_env",
|
||||
"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.11"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
1
community-contributions/sf-patient-brochure/.gitkeep
Normal file
1
community-contributions/sf-patient-brochure/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,517 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "fc57c47f-31fc-4527-af71-ce117d35c480",
|
||||
"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 requests\n",
|
||||
"import json\n",
|
||||
"from typing import List\n",
|
||||
"from dotenv import load_dotenv\n",
|
||||
"from bs4 import BeautifulSoup\n",
|
||||
"from IPython.display import Markdown, display, update_display\n",
|
||||
"from openai import OpenAI\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"id": "d74ea4e7-7d4a-4c85-92d3-8cdb231bc261",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"id": "3eb884ea-02db-4ff8-91f9-c71e40b1cf4a",
|
||||
"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-4o-mini'\n",
|
||||
"openai = OpenAI()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"id": "d48a7b9b-273d-4bc9-997b-c7112e02528c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# A class to represent a Webpage\n",
|
||||
"\n",
|
||||
"# Some websites need you to use proper headers when fetching them:\n",
|
||||
"headers = {\n",
|
||||
" \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"class Website:\n",
|
||||
" def __init__(self, url):\n",
|
||||
" self.url = url\n",
|
||||
" response = requests.get(url, headers=headers)\n",
|
||||
" self.body = response.content\n",
|
||||
" soup = BeautifulSoup(self.body, 'html.parser')\n",
|
||||
" self.title = soup.title.string if soup.title else \"No title found\"\n",
|
||||
"\n",
|
||||
" if soup.body:\n",
|
||||
" for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n",
|
||||
" irrelevant.decompose()\n",
|
||||
" self.text = soup.body.get_text(separator=\"\\n\", strip=True)\n",
|
||||
" else:\n",
|
||||
" self.text = \"\"\n",
|
||||
"\n",
|
||||
" links = [link.get('href') for link in soup.find_all('a')]\n",
|
||||
" self.links = [link for link in links if link]\n",
|
||||
"\n",
|
||||
" def get_contents(self):\n",
|
||||
" return f\"Webpage Title:\\n{self.title}\\nWebpage Contents:\\n{self.text}\\n\\n\"\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"id": "bf51ae6e-91ae-46eb-ac39-dc860454ea4a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def get_condition_links_from_topics_page():\n",
|
||||
" topics_url = \"https://www.thuisarts.nl/overzicht/onderwerpen\"\n",
|
||||
" response = requests.get(topics_url, headers=headers)\n",
|
||||
" soup = BeautifulSoup(response.content, 'html.parser')\n",
|
||||
"\n",
|
||||
" # Find all <a> tags that look like condition pages\n",
|
||||
" links = soup.find_all(\"a\", href=True)\n",
|
||||
" condition_links = []\n",
|
||||
"\n",
|
||||
" for link in links:\n",
|
||||
" href = link['href']\n",
|
||||
" if href.startswith(\"/\"):\n",
|
||||
" href = \"https://www.thuisarts.nl\" + href\n",
|
||||
" if href.startswith(\"https://www.thuisarts.nl/\") and len(href.split(\"/\")) > 3:\n",
|
||||
" condition_links.append(href)\n",
|
||||
"\n",
|
||||
" # Remove duplicates and return\n",
|
||||
" return list(set(condition_links))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"id": "a246ac9f-73fb-4c2d-ab92-6f3f2bf7afac",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"link_system_prompt = \"\"\"You are an assistant that filters URLs for patient education content. \n",
|
||||
"\n",
|
||||
"Only return links that lead to pages about symptoms, health conditions, treatments, or diseases — for example: pages on 'headache', 'diarrhea', 'stomach pain', 'asthma', etc.\n",
|
||||
"\n",
|
||||
"DO NOT return:\n",
|
||||
"- contact pages\n",
|
||||
"- overview/video/image/keuzekaart lists unless they directly link to medical complaints\n",
|
||||
"- navigation or privacy/cookie/social media links\n",
|
||||
"\n",
|
||||
"Respond only with full https links in JSON format, like this:\n",
|
||||
"{\n",
|
||||
" \"links\": [\n",
|
||||
" {\"type\": \"symptom or condition page\", \"url\": \"https://www.thuisarts.nl/hoofdpijn\"},\n",
|
||||
" {\"type\": \"symptom or condition page\", \"url\": \"https://www.thuisarts.nl/buikpijn\"}\n",
|
||||
" ]\n",
|
||||
"}\n",
|
||||
"\"\"\"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"id": "b3ac761e-f583-479e-b8ef-70e70f8f361a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"You are an assistant that filters URLs for patient education content. \n",
|
||||
"\n",
|
||||
"Only return links that lead to pages about symptoms, health conditions, treatments, or diseases — for example: pages on 'headache', 'diarrhea', 'stomach pain', 'asthma', etc.\n",
|
||||
"\n",
|
||||
"DO NOT return:\n",
|
||||
"- contact pages\n",
|
||||
"- overview/video/image/keuzekaart lists unless they directly link to medical complaints\n",
|
||||
"- navigation or privacy/cookie/social media links\n",
|
||||
"\n",
|
||||
"Respond only with full https links in JSON format, like this:\n",
|
||||
"{\n",
|
||||
" \"links\": [\n",
|
||||
" {\"type\": \"symptom or condition page\", \"url\": \"https://www.thuisarts.nl/hoofdpijn\"},\n",
|
||||
" {\"type\": \"symptom or condition page\", \"url\": \"https://www.thuisarts.nl/buikpijn\"}\n",
|
||||
" ]\n",
|
||||
"}\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(link_system_prompt)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"id": "5548e8d4-2813-40fe-a807-cf3661d3a0a9",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"✅ Found 680 condition pages.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"condition_links = get_condition_links_from_topics_page()\n",
|
||||
"print(f\"✅ Found {len(condition_links)} condition pages.\")\n",
|
||||
"\n",
|
||||
"# Format for summary function\n",
|
||||
"selected_links = [{\"url\": link} for link in condition_links]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"id": "8d264592-8b77-425a-be4a-73ef7d32d744",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"def load_existing_summaries(filepath=\"brochure_cache.json\"):\n",
|
||||
" if os.path.exists(filepath):\n",
|
||||
" with open(filepath, \"r\", encoding=\"utf-8\") as f:\n",
|
||||
" return json.load(f)\n",
|
||||
" return {}\n",
|
||||
"\n",
|
||||
"def save_summaries_to_cache(summaries, filepath=\"brochure_cache.json\"):\n",
|
||||
" with open(filepath, \"w\", encoding=\"utf-8\") as f:\n",
|
||||
" json.dump(summaries, f, indent=2, ensure_ascii=False)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"id": "1cdd9456-1262-40a0-bc3f-28d23010ed7f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"selected_links = [{\"url\": link} for link in get_condition_links_from_topics_page()][:10]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"id": "0c2f24ea-fa6b-4431-849a-e1aeaa936022",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"summary_cache = {}\n",
|
||||
"\n",
|
||||
"def summarize_for_brochure(url):\n",
|
||||
" if url in summary_cache:\n",
|
||||
" summary = summary_cache[url]\n",
|
||||
" print(f\"✅ [Cached] {url}\")\n",
|
||||
" print(f\"📄 Summary:\\n{summary}\\n\") # 👈 this prints the cached summary too\n",
|
||||
" return summary\n",
|
||||
"\n",
|
||||
" page = Website(url)\n",
|
||||
"\n",
|
||||
" example = \"\"\"\n",
|
||||
"Example:\n",
|
||||
"\n",
|
||||
"Title: Keelpijn \n",
|
||||
"Summary: Sore throat is a common symptom, often caused by a virus. It usually goes away on its own within a few days. Drink warm fluids, rest your voice, and take paracetamol if needed. See a doctor if the pain lasts more than a week or gets worse.\n",
|
||||
"\n",
|
||||
"Title: Hoofdpijn \n",
|
||||
"Summary: Headaches can have many causes like stress, fatigue, or dehydration. Most are harmless and go away with rest and fluids. Painkillers like paracetamol can help. If headaches are severe, frequent, or different than usual, contact your GP.\n",
|
||||
"\"\"\"\n",
|
||||
"\n",
|
||||
" prompt = f\"\"\"\n",
|
||||
"You are a health writer. Based on the Dutch content below, write a clear, short, brochure-style summary in **English** for patients.\n",
|
||||
"\n",
|
||||
"Use the format: \n",
|
||||
"Title: {page.title} \n",
|
||||
"Summary: <your summary>\n",
|
||||
"\n",
|
||||
"Keep it under 100 words, easy to read, friendly, and medically accurate.\n",
|
||||
"\n",
|
||||
"{example}\n",
|
||||
"\n",
|
||||
"Now use this for:\n",
|
||||
"Title: {page.title}\n",
|
||||
"Content:\n",
|
||||
"{page.text[:3000]}\n",
|
||||
"\"\"\"\n",
|
||||
"\n",
|
||||
" response = openai.chat.completions.create(\n",
|
||||
" model=\"gpt-4\",\n",
|
||||
" messages=[{\"role\": \"user\", \"content\": prompt}],\n",
|
||||
" temperature=0.4\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" summary = response.choices[0].message.content.strip()\n",
|
||||
" summary_cache[url] = summary\n",
|
||||
" return summary\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"id": "af8f9d81-d848-4fb9-ac79-782b39fed4a2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def build_symptom_brochure(links, cache_file=\"brochure_cache.json\"):\n",
|
||||
" brochure = []\n",
|
||||
" cached = load_existing_summaries(cache_file)\n",
|
||||
" print(\"📄 Building summaries for brochure:\\n\")\n",
|
||||
"\n",
|
||||
" for i, item in enumerate(links, 1):\n",
|
||||
" url = item[\"url\"]\n",
|
||||
" if url in cached:\n",
|
||||
" print(f\"✅ [Cached] {url}\")\n",
|
||||
" brochure.append({\"url\": url, \"summary\": cached[url]})\n",
|
||||
" continue\n",
|
||||
" \n",
|
||||
" print(f\"🔄 [{i}/{len(links)}] Summarizing: {url}\")\n",
|
||||
" try:\n",
|
||||
" summary = summarize_for_brochure(url)\n",
|
||||
" print(f\"✅ Summary:\\n{summary}\\n\")\n",
|
||||
" brochure.append({\"url\": url, \"summary\": summary})\n",
|
||||
" cached[url] = summary # Save new summary\n",
|
||||
" save_summaries_to_cache(cached, cache_file)\n",
|
||||
" except Exception as e:\n",
|
||||
" print(f\"❌ Error summarizing {url}: {e}\\n\")\n",
|
||||
" brochure.append({\"url\": url, \"summary\": \"Error generating summary.\"})\n",
|
||||
"\n",
|
||||
" return brochure\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"id": "e9079d6b-538f-4681-9776-4628a111246a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"📄 Building summaries for brochure:\n",
|
||||
"\n",
|
||||
"🔄 [1/10] Summarizing: https://www.thuisarts.nl/sociale-angststoornis\n",
|
||||
"✅ [New] https://www.thuisarts.nl/sociale-angststoornis\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Social Anxiety Disorder\n",
|
||||
"Summary: Social anxiety disorder, or social phobia, is a fear of what others think of you, often leading to panic attacks. Writing down what happens, your thoughts, and feelings can help manage this fear. Positive thinking can also be beneficial when you're feeling anxious. Discussing your concerns with your GP or practice nurse can be helpful. If there's no improvement or symptoms are severe, treatments such as therapy with a psychologist or anxiety medication may be considered.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Social Anxiety Disorder\n",
|
||||
"Summary: Social anxiety disorder, or social phobia, is a fear of what others think of you, often leading to panic attacks. Writing down what happens, your thoughts, and feelings can help manage this fear. Positive thinking can also be beneficial when you're feeling anxious. Discussing your concerns with your GP or practice nurse can be helpful. If there's no improvement or symptoms are severe, treatments such as therapy with a psychologist or anxiety medication may be considered.\n",
|
||||
"\n",
|
||||
"✅ [Cached] https://www.thuisarts.nl/diabetes-type-2\n",
|
||||
"🔄 [3/10] Summarizing: https://www.thuisarts.nl/morton-neuroom\n",
|
||||
"✅ [New] https://www.thuisarts.nl/morton-neuroom\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Morton's Neuroma | Thuisarts.nl \n",
|
||||
"Summary: Morton's Neuroma is a pinched nerve in the forefoot, causing burning pain in the forefoot and toes. It often results from wearing too narrow shoes or high heels. Wearing comfortable, roomy shoes can help alleviate symptoms. For severe pain, paracetamol can be taken. Sometimes, a custom shoe insole can also help.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Morton's Neuroma | Thuisarts.nl \n",
|
||||
"Summary: Morton's Neuroma is a pinched nerve in the forefoot, causing burning pain in the forefoot and toes. It often results from wearing too narrow shoes or high heels. Wearing comfortable, roomy shoes can help alleviate symptoms. For severe pain, paracetamol can be taken. Sometimes, a custom shoe insole can also help.\n",
|
||||
"\n",
|
||||
"🔄 [4/10] Summarizing: https://www.thuisarts.nl/borstvergroting\n",
|
||||
"✅ [New] https://www.thuisarts.nl/borstvergroting\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Breast Augmentation | Thuisarts.nl \n",
|
||||
"Summary: A breast augmentation is a procedure where a plastic surgeon inserts fillings into your breasts, under general anesthesia. The surgery takes about an hour. Consider the pros and cons carefully. Benefits may include a more positive body image and increased self-confidence. Risks may include infection, bleeding, scarring, or hardening of the breasts over time. Often, a follow-up surgery is needed later. If you smoke, it's important to quit three weeks before surgery.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Breast Augmentation | Thuisarts.nl \n",
|
||||
"Summary: A breast augmentation is a procedure where a plastic surgeon inserts fillings into your breasts, under general anesthesia. The surgery takes about an hour. Consider the pros and cons carefully. Benefits may include a more positive body image and increased self-confidence. Risks may include infection, bleeding, scarring, or hardening of the breasts over time. Often, a follow-up surgery is needed later. If you smoke, it's important to quit three weeks before surgery.\n",
|
||||
"\n",
|
||||
"🔄 [5/10] Summarizing: https://www.thuisarts.nl/kijkoperatie-in-buik\n",
|
||||
"✅ [New] https://www.thuisarts.nl/kijkoperatie-in-buik\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Abdominal Laparoscopy | Thuisarts.nl\n",
|
||||
"Summary: An abdominal laparoscopy allows the doctor to examine or operate in your abdomen. Small tubes with a camera and tools are inserted through tiny incisions. You'll have a pre-operation discussion with your surgeon and anesthesiologist. You will be deeply sedated for the procedure. You cannot drive home post-operation, so arrange for someone to pick you up. Recovery usually requires a week off work, sometimes longer.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Abdominal Laparoscopy | Thuisarts.nl\n",
|
||||
"Summary: An abdominal laparoscopy allows the doctor to examine or operate in your abdomen. Small tubes with a camera and tools are inserted through tiny incisions. You'll have a pre-operation discussion with your surgeon and anesthesiologist. You will be deeply sedated for the procedure. You cannot drive home post-operation, so arrange for someone to pick you up. Recovery usually requires a week off work, sometimes longer.\n",
|
||||
"\n",
|
||||
"🔄 [6/10] Summarizing: https://www.thuisarts.nl/veranderingen-in-zorg-als-je-18-wordt\n",
|
||||
"✅ [New] https://www.thuisarts.nl/veranderingen-in-zorg-als-je-18-wordt\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Changes in Care When You Turn 18 | Thuisarts.nl\n",
|
||||
"Summary: As you become an adult, usually around 18, you transition from child to adult healthcare. You will start to take more responsibility, such as making appointments and requesting medications, giving you more control over your care. You will create a plan detailing what you need to manage this independently, with support provided to help you. This transition is a gradual process, with preparation beginning before you turn 18.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Changes in Care When You Turn 18 | Thuisarts.nl\n",
|
||||
"Summary: As you become an adult, usually around 18, you transition from child to adult healthcare. You will start to take more responsibility, such as making appointments and requesting medications, giving you more control over your care. You will create a plan detailing what you need to manage this independently, with support provided to help you. This transition is a gradual process, with preparation beginning before you turn 18.\n",
|
||||
"\n",
|
||||
"🔄 [7/10] Summarizing: https://www.thuisarts.nl/zon-en-zonnebrand\n",
|
||||
"✅ [New] https://www.thuisarts.nl/zon-en-zonnebrand\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Sun and Sunburn | Thuisarts.nl\n",
|
||||
"Summary: Protect your skin from excessive sunlight to avoid sunburn. If you notice your skin burning, immediately move out of the sun. Cool your skin with wet cloths if it hurts and take paracetamol for severe pain. Stay out of the sun for at least three days to allow your skin to recover. If you have symptoms of sunstroke, sun allergy, or eczema, seek medical advice.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Sun and Sunburn | Thuisarts.nl\n",
|
||||
"Summary: Protect your skin from excessive sunlight to avoid sunburn. If you notice your skin burning, immediately move out of the sun. Cool your skin with wet cloths if it hurts and take paracetamol for severe pain. Stay out of the sun for at least three days to allow your skin to recover. If you have symptoms of sunstroke, sun allergy, or eczema, seek medical advice.\n",
|
||||
"\n",
|
||||
"🔄 [8/10] Summarizing: https://www.thuisarts.nl/ganglion\n",
|
||||
"✅ [New] https://www.thuisarts.nl/ganglion\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Ganglion | Thuisarts.nl \n",
|
||||
"Summary: A ganglion is a small bump that can appear on your wrist, finger, or foot. It is a protrusion from the joint and is harmless. In half of the cases, a ganglion disappears on its own. If you notice such a bump, there is usually no cause for concern.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Ganglion | Thuisarts.nl \n",
|
||||
"Summary: A ganglion is a small bump that can appear on your wrist, finger, or foot. It is a protrusion from the joint and is harmless. In half of the cases, a ganglion disappears on its own. If you notice such a bump, there is usually no cause for concern.\n",
|
||||
"\n",
|
||||
"🔄 [9/10] Summarizing: https://www.thuisarts.nl/kunstheup\n",
|
||||
"✅ [New] https://www.thuisarts.nl/kunstheup\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Hip Replacement | Thuisarts.nl\n",
|
||||
"Summary: A hip replacement can be an option if you are experiencing severe pain or stiffness in your hip, such as from advanced arthritis or another hip disease. This is usually considered when other treatments like physiotherapy and painkillers have not provided enough relief. You can discuss with your hospital doctor whether a hip replacement is suitable for you. A hip prosthesis typically lasts longer than 20 years.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Hip Replacement | Thuisarts.nl\n",
|
||||
"Summary: A hip replacement can be an option if you are experiencing severe pain or stiffness in your hip, such as from advanced arthritis or another hip disease. This is usually considered when other treatments like physiotherapy and painkillers have not provided enough relief. You can discuss with your hospital doctor whether a hip replacement is suitable for you. A hip prosthesis typically lasts longer than 20 years.\n",
|
||||
"\n",
|
||||
"🔄 [10/10] Summarizing: https://www.thuisarts.nl/gezond-leven\n",
|
||||
"✅ [New] https://www.thuisarts.nl/gezond-leven\n",
|
||||
"📄 Summary:\n",
|
||||
"Title: Healthy Living | Thuisarts.nl\n",
|
||||
"Summary: For good health, it's important to eat, drink, and sleep well, stay active, relax, and maintain social contacts. Avoiding substances like alcohol is also beneficial. If you want to make changes to your lifestyle, take it step by step. Discuss your plans with your GP or practice nurse. Whether it's about healthy eating, exercise, sleep, stress management, social contact, or substance use, they can provide guidance and support.\n",
|
||||
"\n",
|
||||
"✅ Summary:\n",
|
||||
"Title: Healthy Living | Thuisarts.nl\n",
|
||||
"Summary: For good health, it's important to eat, drink, and sleep well, stay active, relax, and maintain social contacts. Avoiding substances like alcohol is also beneficial. If you want to make changes to your lifestyle, take it step by step. Discuss your plans with your GP or practice nurse. Whether it's about healthy eating, exercise, sleep, stress management, social contact, or substance use, they can provide guidance and support.\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"brochure = build_symptom_brochure(selected_links)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"id": "e2121c3c-aa6a-4640-8e19-6ca6ccf84783",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def export_brochure_to_txt(brochure, filepath=\"brochure_summaries.txt\"):\n",
|
||||
" if not brochure:\n",
|
||||
" print(\"⚠️ No summaries to export.\")\n",
|
||||
" return\n",
|
||||
"\n",
|
||||
" with open(filepath, \"w\", encoding=\"utf-8\") as f:\n",
|
||||
" for item in brochure:\n",
|
||||
" url = item.get(\"url\", \"Unknown URL\")\n",
|
||||
" summary = item.get(\"summary\", \"No summary available.\")\n",
|
||||
" f.write(f\"URL: {url}\\n\")\n",
|
||||
" f.write(f\"{summary}\\n\\n\")\n",
|
||||
"\n",
|
||||
" print(f\"📁 Exported {len(brochure)} summaries to {filepath}\")\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"id": "f14288f9-4d1c-4a0e-aaf4-9f86324b0602",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"📁 Exported 10 summaries to brochure_summaries.txt\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"export_brochure_to_txt(brochure)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c23e89db-3ded-4189-a227-6ca6ac2f1332",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"###---it works---"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a700e4f3-fb6a-499a-a579-6f9b8ad35c9f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
URL: https://www.thuisarts.nl/sociale-angststoornis
|
||||
Title: Social Anxiety Disorder
|
||||
Summary: Social anxiety disorder, or social phobia, is a fear of what others think of you, often leading to panic attacks. Writing down what happens, your thoughts, and feelings can help manage this fear. Positive thinking can also be beneficial when you're feeling anxious. Discussing your concerns with your GP or practice nurse can be helpful. If there's no improvement or symptoms are severe, treatments such as therapy with a psychologist or anxiety medication may be considered.
|
||||
|
||||
URL: https://www.thuisarts.nl/diabetes-type-2
|
||||
Title: Diabetes type 2 | Thuisarts.nl
|
||||
Summary: Type 2 diabetes, also known as sugar disease, is characterized by high blood sugar levels. Leading a healthy lifestyle is crucial: eat healthily, lose weight, exercise regularly, relax, and quit smoking. If blood sugar levels remain high, medication may be required. Regular check-ups, usually every three months, with your GP or practice nurse are essential.
|
||||
|
||||
URL: https://www.thuisarts.nl/morton-neuroom
|
||||
Title: Morton's Neuroma | Thuisarts.nl
|
||||
Summary: Morton's Neuroma is a pinched nerve in the forefoot, causing burning pain in the forefoot and toes. It often results from wearing too narrow shoes or high heels. Wearing comfortable, roomy shoes can help alleviate symptoms. For severe pain, paracetamol can be taken. Sometimes, a custom shoe insole can also help.
|
||||
|
||||
URL: https://www.thuisarts.nl/borstvergroting
|
||||
Title: Breast Augmentation | Thuisarts.nl
|
||||
Summary: A breast augmentation is a procedure where a plastic surgeon inserts fillings into your breasts, under general anesthesia. The surgery takes about an hour. Consider the pros and cons carefully. Benefits may include a more positive body image and increased self-confidence. Risks may include infection, bleeding, scarring, or hardening of the breasts over time. Often, a follow-up surgery is needed later. If you smoke, it's important to quit three weeks before surgery.
|
||||
|
||||
URL: https://www.thuisarts.nl/kijkoperatie-in-buik
|
||||
Title: Abdominal Laparoscopy | Thuisarts.nl
|
||||
Summary: An abdominal laparoscopy allows the doctor to examine or operate in your abdomen. Small tubes with a camera and tools are inserted through tiny incisions. You'll have a pre-operation discussion with your surgeon and anesthesiologist. You will be deeply sedated for the procedure. You cannot drive home post-operation, so arrange for someone to pick you up. Recovery usually requires a week off work, sometimes longer.
|
||||
|
||||
URL: https://www.thuisarts.nl/veranderingen-in-zorg-als-je-18-wordt
|
||||
Title: Changes in Care When You Turn 18 | Thuisarts.nl
|
||||
Summary: As you become an adult, usually around 18, you transition from child to adult healthcare. You will start to take more responsibility, such as making appointments and requesting medications, giving you more control over your care. You will create a plan detailing what you need to manage this independently, with support provided to help you. This transition is a gradual process, with preparation beginning before you turn 18.
|
||||
|
||||
URL: https://www.thuisarts.nl/zon-en-zonnebrand
|
||||
Title: Sun and Sunburn | Thuisarts.nl
|
||||
Summary: Protect your skin from excessive sunlight to avoid sunburn. If you notice your skin burning, immediately move out of the sun. Cool your skin with wet cloths if it hurts and take paracetamol for severe pain. Stay out of the sun for at least three days to allow your skin to recover. If you have symptoms of sunstroke, sun allergy, or eczema, seek medical advice.
|
||||
|
||||
URL: https://www.thuisarts.nl/ganglion
|
||||
Title: Ganglion | Thuisarts.nl
|
||||
Summary: A ganglion is a small bump that can appear on your wrist, finger, or foot. It is a protrusion from the joint and is harmless. In half of the cases, a ganglion disappears on its own. If you notice such a bump, there is usually no cause for concern.
|
||||
|
||||
URL: https://www.thuisarts.nl/kunstheup
|
||||
Title: Hip Replacement | Thuisarts.nl
|
||||
Summary: A hip replacement can be an option if you are experiencing severe pain or stiffness in your hip, such as from advanced arthritis or another hip disease. This is usually considered when other treatments like physiotherapy and painkillers have not provided enough relief. You can discuss with your hospital doctor whether a hip replacement is suitable for you. A hip prosthesis typically lasts longer than 20 years.
|
||||
|
||||
URL: https://www.thuisarts.nl/gezond-leven
|
||||
Title: Healthy Living | Thuisarts.nl
|
||||
Summary: For good health, it's important to eat, drink, and sleep well, stay active, relax, and maintain social contacts. Avoiding substances like alcohol is also beneficial. If you want to make changes to your lifestyle, take it step by step. Discuss your plans with your GP or practice nurse. Whether it's about healthy eating, exercise, sleep, stress management, social contact, or substance use, they can provide guidance and support.
|
||||
|
||||
@@ -0,0 +1,933 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 113,
|
||||
"id": "030082e9-edee-40b6-9f17-b6a683f2e334",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import requests\n",
|
||||
"from dotenv import load_dotenv\n",
|
||||
"import bs4\n",
|
||||
"from bs4 import BeautifulSoup\n",
|
||||
"import lxml\n",
|
||||
"from IPython.display import Markdown, display\n",
|
||||
"from openai import OpenAI"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 115,
|
||||
"id": "c87e997d-e1d6-4b6f-9c76-3fb1d607f7cd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"openai = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 116,
|
||||
"id": "e450cb33-1ae4-435e-b155-35f2bd7ab78e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"headers={\n",
|
||||
" \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n",
|
||||
"} \n",
|
||||
"#a dictionary named header so that we can grab same html code as the user ,and also to avoid blocks,captcha and error403"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 119,
|
||||
"id": "63a57fb7-79db-444b-968b-c9314b1f3d3f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Website:\n",
|
||||
" def __init__(self,url):\n",
|
||||
" self.url=url\n",
|
||||
" response= requests.get(url,headers=headers,timeout=30)\n",
|
||||
" soup=BeautifulSoup(response.content,'lxml')\n",
|
||||
" self.title=soup.title.string if soup.title else \"No title found\"#scraping the content\n",
|
||||
" for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):#cleaning the content\n",
|
||||
" irrelevant.decompose()\n",
|
||||
" #using .get_text() method of Beautiful soup\n",
|
||||
" self.text = soup.body.get_text(separator=\"\\n\", strip=True)#creating space between different lines and removing leading whitespaces by strip=true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 121,
|
||||
"id": "7369159d-1f36-43c9-b7e7-a0b65b56426b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Latest and Trending Entertainment News, Celebrity News, Movie News, Breaking News | Entertainment - Times of India\n",
|
||||
"Sign In\n",
|
||||
"TOI\n",
|
||||
"Go to\n",
|
||||
"TOI\n",
|
||||
"Etimes\n",
|
||||
"home\n",
|
||||
"cinema\n",
|
||||
"news\n",
|
||||
"movie reviews\n",
|
||||
"movie listings\n",
|
||||
"box office\n",
|
||||
"anime\n",
|
||||
"previews\n",
|
||||
"did you know\n",
|
||||
"videos\n",
|
||||
"showtimes\n",
|
||||
"blogs\n",
|
||||
"awards\n",
|
||||
"News\n",
|
||||
"entertainment\n",
|
||||
"Trending\n",
|
||||
"Javed Akhtar\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Gauri Khan\n",
|
||||
"Blake Lively\n",
|
||||
"Trisha Krishnan\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Housefull 5\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Sitaare Zameen Par Movie Review\n",
|
||||
"Javed Akhtar\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Gauri Khan\n",
|
||||
"Blake Lively\n",
|
||||
"Trisha Krishnan\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Housefull 5\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Sitaare Zameen Par Movie Review\n",
|
||||
"Javed Akhtar\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Gauri Khan\n",
|
||||
"Blake Lively\n",
|
||||
"Trisha Krishnan\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Housefull 5\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Sitaare Zameen Par Movie Review\n",
|
||||
"Sudhanshu: At 52, John, Dino all of them look like rockstars - EXCLUSIVE\n",
|
||||
"Sudhanshu Pandey, recognized from 'Band Of Boys' and 'Anupama', defies his 50 years with his fitness. He credits his peers like Dino Moria, Arjun Rampal, and John Abraham for inspiring him to maintain a fit and youthful appearance. Pandey also admires Anil Kapoor's energy and dedication, motivating him to continue prioritizing fitness and inspiring others.\n",
|
||||
"Previous\n",
|
||||
"Sonakshi breaks silence on her rift with Luv and Kussh\n",
|
||||
"Madhuri once chased Aamir with hockey stick for THIS reason\n",
|
||||
"Ranbir-Raj Kapoor, Diljit-Hania, Samay-IGL: Top 5 news\n",
|
||||
"Big B's savage reply to troll over cybercrime callertune\n",
|
||||
"Anushka on keeping kids Vamika, Akaay away from public eye\n",
|
||||
"Apoorva Mukhija recalls witnessing gender bias at home\n",
|
||||
"Danish influencer seeks help to find papads from Big B\n",
|
||||
"Sunjay Kapur's reception pics with Priya Sachdev goes viral\n",
|
||||
"Big B schools trolls commenting 'buddha sathiya gaya hai'\n",
|
||||
"Anushka on how she and Virat divide parenting duties\n",
|
||||
"Brahmaji reacts to Vishnu's 7,000-acre land in New Zealand\n",
|
||||
"Diljit says THIS amidst trolling for working with Hania\n",
|
||||
"Riddhi found it ridiculous to like SRK's mother in Jawan\n",
|
||||
"Priya Sachdev once called husband Sunjay Kapur ‘misunderstood’\n",
|
||||
"Next\n",
|
||||
"1\n",
|
||||
"2\n",
|
||||
"3\n",
|
||||
"Hindi\n",
|
||||
"See All\n",
|
||||
"Sudhanshu: At 52, John, Dino all of them look like rockstars - EXCLUSIVE\n",
|
||||
"Sudhanshu Pandey, recognized from 'Band Of Boys' and 'Anupama', defies his 50 years with his fitness. He credits his peers like Dino Moria, Arjun Rampal, and John Abraham for inspiring him to maintain a fit and youthful appearance. Pandey also admires Anil Kapoor's energy and dedication, motivating him to continue prioritizing fitness and inspiring others.\n",
|
||||
"Sonakshi breaks silence on her rift with Luv and Kussh\n",
|
||||
"Madhuri once chased Aamir with hockey stick for THIS reason\n",
|
||||
"Ranbir-Raj Kapoor, Diljit-Hania, Samay-IGL: Top 5 news\n",
|
||||
"Anushka on keeping kids Vamika, Akaay away from public eye\n",
|
||||
"Anushka Sharma and Virat Kohli are committed to shielding their children, Vamika and Akaay, from the constant glare of public attention. In a recent interview, Anushka emphasized the couple's focus on instilling strong values and ensuring a normal upbringing for their kids.\n",
|
||||
"Apoorva Mukhija recalls witnessing gender bias at home\n",
|
||||
"Regional\n",
|
||||
"When Samantha’s class 10 mark sheet got leaked\n",
|
||||
"Throwback to when a nostalgic memory made its way across the internet — Samantha Ruth Prabhu’s Class 10 mark sheet! The actress’s charming on-screen presence and grounded personality were once again in the spotlight as her old school report card began doing the rounds on social media.\n",
|
||||
"Actor Tushar Ghadigaonkar passes away at 34\n",
|
||||
"‘Kuberaa’ Twitter review: Netizens calls it a ‘Blockbuster’\n",
|
||||
"Mammootty’s health- Brittas says actor doing well\n",
|
||||
"Kavya Madhavan’s father P. Madhavan passes away\n",
|
||||
"‘The Raja Saab’ teaser: Prabhas shines in this horror comedy\n",
|
||||
"Mammootty’s father-in-law P S Abu passes away\n",
|
||||
"Videos\n",
|
||||
"See All\n",
|
||||
"Previous\n",
|
||||
"03:07\n",
|
||||
"Ananya Panday’s Garden Bond With Parrots Wins Hearts\n",
|
||||
"88 views | 2 hours ago\n",
|
||||
"03:14\n",
|
||||
"Sameera Reddy’s Healing Journey Through Yoga\n",
|
||||
"31 views | 2 hours ago\n",
|
||||
"03:13\n",
|
||||
"Kriti Kharbanda’s Modern Maharani Look Stuns Instagram\n",
|
||||
"26 views | 2 hours ago\n",
|
||||
"03:12\n",
|
||||
"Bobby Deol Meets Diljit Dosanjh: Punjabi Power Goes Viral\n",
|
||||
"81 views | 2 hours ago\n",
|
||||
"03:19\n",
|
||||
"‘Sitaare Zameen Par’: Riteish Deshmukh’s Emotional Shoutout For Genelia’s Big Win\n",
|
||||
"162 views | 2 hours ago\n",
|
||||
"03:26\n",
|
||||
"Varun Dhawan Stuns With 50 Push-Ups Alongside Army Cadets on Border 2 Set\n",
|
||||
"21 views | 2 hours ago\n",
|
||||
"03:00\n",
|
||||
"VIDYA BALAN TURNS HEADS WITH CASUAL AIRPORT LOOK\n",
|
||||
"16 views | 2 hours ago\n",
|
||||
"03:05\n",
|
||||
"MANDHIRA KAPUR BREAKS DOWN IN EMOTIONAL POST FOR LATE BROTHER SUNJAY KAPUR\n",
|
||||
"1.2K views | 2 hours ago\n",
|
||||
"03:28\n",
|
||||
"SALMAN KHAN TAKES A BRUTAL DIG AT SOHAIL’S DIVORCE ON NATIONAL TV\n",
|
||||
"185 views | 2 hours ago\n",
|
||||
"03:15\n",
|
||||
"RAJINIKANTH CAUSES FAN RIOT DURING ‘JAILER 2’ SHOOT IN MYSORE\n",
|
||||
"26 views | 2 hours ago\n",
|
||||
"03:10\n",
|
||||
"IBRAHIM ALI KHAN KISSES HIS DOG AT AIRPORT IN HEARTWARMING FAREWELL\n",
|
||||
"20 views | 3 hours ago\n",
|
||||
"03:09\n",
|
||||
"ANUPAMAA SET GUTTED IN MASSIVE FIRE | CREW ESCAPES, CINE BODY DEMANDS ACTION\n",
|
||||
"1.2K views | 3 hours ago\n",
|
||||
"Next\n",
|
||||
"1\n",
|
||||
"2\n",
|
||||
"3\n",
|
||||
"4\n",
|
||||
"5\n",
|
||||
"6\n",
|
||||
"7\n",
|
||||
"8\n",
|
||||
"9\n",
|
||||
"10\n",
|
||||
"11\n",
|
||||
"World\n",
|
||||
"See All\n",
|
||||
"Aamir to Tom: Celebs on a mission to 'Save Cinema'\n",
|
||||
"'How to Train Your Dragon' beats '28 Years Later' and 'Elio' to top the US box office on second weekend\n",
|
||||
"Blake Lively is heartbroken after friendship ends with Taylor Swift; accepts the music mogul won't be returning - Deets inside\n",
|
||||
"Selena-Hailey UNFOLLOW each other amid Bieber drama\n",
|
||||
"Judge gives Baldoni access to Blake-Taylor messages\n",
|
||||
"Trending Now\n",
|
||||
"# Sidharth Malhotra-Kiara Advani\n",
|
||||
"# AbRam Khan-Taimur Ali Khan\n",
|
||||
"# Janhvi Kapoor\n",
|
||||
"# Salman Khan\n",
|
||||
"# Hema Malini\n",
|
||||
"# Salman Khan\n",
|
||||
"# Gauri Khan\n",
|
||||
"# Shah Rukh Khan\n",
|
||||
"# Chahatt Khanna\n",
|
||||
"Visual Stories\n",
|
||||
"See All\n",
|
||||
"Previous\n",
|
||||
"Kuberaa’s Sameera to Pushpa’s Srivalli: Rashmika Mandanna’s most iconic on-screen avatars\n",
|
||||
"Ahaana Krishna’s ethereal photo series is straight out of a dream\n",
|
||||
"Rashmika Mandanna to Rakul Preet Singh: Best pictures of the week featuring south actresses\n",
|
||||
"Gauri Khan's most loved saree looks - An ode to modern day elegance\n",
|
||||
"South Indian beauties whose smiles will light up your Monday\n",
|
||||
"Karishma Tanna Slays Every Frame\n",
|
||||
"Tamannaah Bhatia’s traditional looks\n",
|
||||
"Malavika Mohanan's radiant pics\n",
|
||||
"Neha Shetty stuns in every shade of blue\n",
|
||||
"Thalapathy Vijay’s top 10 blockbuster movies worth re-watching!\n",
|
||||
"In pic: Mesmerizing looks of Shruti Haasan\n",
|
||||
"Dushara Vijayan’s Most Elegant Fashion Moments\n",
|
||||
"Next\n",
|
||||
"1\n",
|
||||
"2\n",
|
||||
"3\n",
|
||||
"More Stories\n",
|
||||
"Sonakshi Sinha breaks silence on her rumoured rift with brothers Luv and Kussh Sinha: 'My effort is always to support them...'\n",
|
||||
"Madhuri Dixit once chased Aamir Khan with a hockey stick for THIS reason on sets of Dil: 'People fool you and you believe them'\n",
|
||||
"Mohanlal declines to continue as president at AMMA’s general body meeting- Deets Inside\n",
|
||||
"Blockbusters Ranbir Kapoor turned down: Films that became hits without him\n",
|
||||
"Anushka Sharma reveals why she and Virat Kohli are keeping their children Vamika and Akaay away from the public eye: 'We don't want to raise brats'\n",
|
||||
"Apoorva Mukhija recalls witnessing gender bias at home: 'My mother did it all, but father got credit for showing up at PTMs'\n",
|
||||
"Amitabh Bachchan gives a savage reply to a troll over his viral cybercrime caller tune: 'Sarkar ko bolo bhai..'\n",
|
||||
"Danish influencer asks fans to help her find papads from Amitabh Bachchan; netizens say 'he also used to grow basmati rice'\n",
|
||||
"Days after his untimely demise, Sunjay Kapur's reception photos with Priya Sachdev goes viral; Looked dashing in hand embroidered shoes, written 'I do'\n",
|
||||
"Priyanka Chopra Jonas recollects walking into a trap set by John Cena, Idris Elba on sets of 'Heads of State'\n",
|
||||
"Bobby Deol's London vacation sparks fan frenzy: viral video shows actor posing for selfies outside restaurant\n",
|
||||
"Amitabh Bachchah gives befitting replies to 'buddha sathiya gaya hai', ‘ganja’ comments by trolls: 'Ek din, Bhagwan naa kare voh din jaldi aaye...'\n",
|
||||
"Sai Pallavi’s best performances\n",
|
||||
"Brahmaji clears the air about Vishnu Manchu purchasing 7,000-acre land in New Zealand: 'I was pulling their leg as usual...'\n",
|
||||
"Anushka Sharma reveals how she and Virat Kohli divide the parenting duties: 'I will be the primary caregiver, he plays round the year'\n",
|
||||
"Ranbir Kapoor's 'Awara' look sparks rumours of Raj Kapoor tribute, Diljit Dosanjh slammed for working with Hania Aamir in Sardaar Ji 3: Top 5 news\n",
|
||||
"Has Kiara Advani been approached to play Meena Kumari in her biopic? Here's what we know\n",
|
||||
"Top 5 psychological Anime every thriller fan must watch\n",
|
||||
"Load More Stories\n",
|
||||
"# Latest Movies 2025\n",
|
||||
"# Best Bollywood Movies 2025\n",
|
||||
"# Hollywood Movie 2025\n",
|
||||
"# Tamil Movies 2025\n",
|
||||
"# Telugu Movies 2025\n",
|
||||
"# Malayalam Movies 2025\n",
|
||||
"# Kannada Movies 2025\n",
|
||||
"# Marathi Movies 2025\n",
|
||||
"# Bengali Movies 2025\n",
|
||||
"# Top Rated Movies 2025\n",
|
||||
"# Best Hindi Movies\n",
|
||||
"# Best English Movies\n",
|
||||
"Hot on the Web\n",
|
||||
"Salman Khan\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Blood Pressure\n",
|
||||
"Big Cat Species\n",
|
||||
"Trisha\n",
|
||||
"Sitaare Zameen Par Review\n",
|
||||
"Ancient Indigenous Tribes\n",
|
||||
"Hair Growth Tips\n",
|
||||
"Kidney Health\n",
|
||||
"Kuberaa Review\n",
|
||||
"Blake Lively\n",
|
||||
"Reverse Fatty Liver\n",
|
||||
"Skincare Hacks\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Baby Girl Names\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Kidney Disease Symptoms\n",
|
||||
"Javed Akhtar\n",
|
||||
"Heart Attack\n",
|
||||
"Ram Kapoor Diet\n",
|
||||
"Liver Damage\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Gauri Khan\n",
|
||||
"Baba Vanga Prediction\n",
|
||||
"Baby Boy Names\n",
|
||||
"Navjot Singh Sidhu\n",
|
||||
"Housefull 5 Box Office Collection\n",
|
||||
"DNA Movie Review\n",
|
||||
"Kidney Damage Symptoms\n",
|
||||
"Popular Waterfalls In India\n",
|
||||
"Linkedin Ceo On AI Killing Jobs\n",
|
||||
"Tesla Robotaxi\n",
|
||||
"Early Cancer Detection\n",
|
||||
"Harvard Research Reveals\n",
|
||||
"American Destinations Explore Without Passport\n",
|
||||
"Amouranth\n",
|
||||
"Mouth Larvae\n",
|
||||
"Doomsday Fish\n",
|
||||
"Salman Khan AVM\n",
|
||||
"Ginger Health Tips\n",
|
||||
"Trending Topics\n",
|
||||
"Latest Movies\n",
|
||||
"Bollywood Movies\n",
|
||||
"Hollywood Movies\n",
|
||||
"Tamil Movies 2025\n",
|
||||
"Telugu Movies 2025\n",
|
||||
"Malayalam Movies 2025\n",
|
||||
"Kannada Movies 2025\n",
|
||||
"Marathi Movies 2025\n",
|
||||
"Bengali Movies 2025\n",
|
||||
"Top Rated Movies 2025\n",
|
||||
"Best Hindi Movies\n",
|
||||
"Best English Movies\n",
|
||||
"Best Telugu Movies\n",
|
||||
"Best Tamil Movies\n",
|
||||
"Best Malayalam Movies\n",
|
||||
"Best Kannada Movies\n",
|
||||
"Best Bengali Movies\n",
|
||||
"Upcoming Hindi Movies\n",
|
||||
"Best Movies Of All Time\n",
|
||||
"Best Hindi Movies of All Time\n",
|
||||
"Latest English Movies\n",
|
||||
"Latest Malayalam Movies\n",
|
||||
"English TV News\n",
|
||||
"Tamil TV News\n",
|
||||
"Telugu TV News\n",
|
||||
"Malayalam TV News\n",
|
||||
"Kannada TV News\n",
|
||||
"Movie Reviews\n",
|
||||
"Bhojpuri Cinema News\n",
|
||||
"Gujarati Cinema News\n",
|
||||
"Popular Categories\n",
|
||||
"Viral News\n",
|
||||
"K Pop News\n",
|
||||
"Web Series News\n",
|
||||
"Anime News\n",
|
||||
"Upcoming English Movies\n",
|
||||
"Upcoming Tamil Movies\n",
|
||||
"Upcoming Telugu Movies\n",
|
||||
"Upcoming Malayalam Movies\n",
|
||||
"Upcoming Kannada Movies\n",
|
||||
"Fashion Tips\n",
|
||||
"Travel News\n",
|
||||
"Entertainment News\n",
|
||||
"Bollywood News\n",
|
||||
"Tollywood News\n",
|
||||
"Kollywood News\n",
|
||||
"Mollywood News\n",
|
||||
"Food News\n",
|
||||
"Latest Hindi Movies\n",
|
||||
"Latest Tamil Movies\n",
|
||||
"Parenting Tips\n",
|
||||
"Home Remedies\n",
|
||||
"Weight Loss\n",
|
||||
"Beauty Tips\n",
|
||||
"Parenting Tips\n",
|
||||
"Hindi Videos\n",
|
||||
"Hindi Video Songs\n",
|
||||
"Bhojpuri Music Videos\n",
|
||||
"Latest Telugu Movies\n",
|
||||
"Bhojpuri Music Video\n",
|
||||
"Hindi TV News\n",
|
||||
"Latest News\n",
|
||||
"NHL free agency turns spicy as Mitch Marner and Connor McDavid eye shorter deals to cash in later\n",
|
||||
"Olive Ridley turtle washed ashore at Polem\n",
|
||||
"Who is Thomas Fugate? Meet the 22-year-old leading Trump's terrorism unit amid Iran fiasco\n",
|
||||
"'And that's why Putin's the boss': Trump rebukes former Russian President Medvedev; warns against treating 'N word casually'\n",
|
||||
"Govt plans ₹10cr road on Bicholim-Dodamarg route\n",
|
||||
"Former WWE star Batista eyed for Road House 2 sequel\n",
|
||||
"Sonakshi Sinha breaks silence on her rumoured rift with brothers Luv and Kussh Sinha: 'My effort is always to support them...'\n",
|
||||
"Andre Agassi and Steffi Graf’s son Jaden Agassi shows love for girlfriend Catherine Holt’s bold new photo from bedroom series\n",
|
||||
"Is WWE planning to change Cody Rhodes’ iconic entrance theme song ‘Kingdom’?\n",
|
||||
"Velumani says he didn’t attend RSS event in Coimbatore\n",
|
||||
"Strait of Hormuz: Oil supply not an issue for India; 'pricing is a bigger concern,' what experts say\n",
|
||||
"Madhuri Dixit once chased Aamir Khan with a hockey stick for THIS reason on sets of Dil: 'People fool you and you believe them'\n",
|
||||
"As commissions fall, India’s ride-hailing firms test viability of flat-fee economics\n",
|
||||
"Analysing what Trump’s strikes mean for Iran\n",
|
||||
"Trump's clarification on 'Iran regime change' divides MAGA further: JD Vance, Hegseth, Marco Rubio 'humiliated'\n",
|
||||
"Laughter Chefs 2: Krushna Abhishek roasts Rahul Vaidya for his in-famous feud with cricketer Virat Kohli\n",
|
||||
"“I could have passed Dan Ticktum”: Edoardo Mortara regrets Attack Mode strategy at Jakarta E-Prix\n",
|
||||
"India vs England Test: Sunil Gavaskar calls for Rishabh Pant's signature somersault celebration, wicketkeeper politely declines - WATCH\n",
|
||||
"Copyright © 2025 Bennett, Coleman & Co. Ltd. All rights reserved. For reprint rights: Times Syndication Service\n",
|
||||
"Follow us on\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"gossip= Website(\"https://timesofindia.indiatimes.com/entertainment\")\n",
|
||||
"print(gossip.title)\n",
|
||||
"print(gossip.text)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 123,
|
||||
"id": "a6f30380-1b91-48e4-9c86-df0369e2e675",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"system_prompt = \"\"\"\n",
|
||||
"You are a stylish and culturally aware assistant who specializes in summarizing and discussing fashion trends, celebrity style, entertainment news, and television gossip.\n",
|
||||
"\n",
|
||||
"You stay updated on Hollywood, Bollywood, and the television world—including celebrity rumors, drama, reality TV updates, show recaps, and behind-the-scenes stories.\n",
|
||||
"\n",
|
||||
"When summarizing content, be engaging, concise, and insightful. Focus on what's trending, who's wearing what, and what everyone is talking about in fashion and entertainment. Maintain a fun yet informative tone, like a pop culture expert writing for a lifestyle magazine.\n",
|
||||
"\n",
|
||||
"If content includes TV gossip, highlight key rumors, casting updates, fan reactions, and noteworthy moments from popular shows.\n",
|
||||
"\"\"\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 125,
|
||||
"id": "30822d5c-d518-451c-b31f-44afa2a3b37a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def user_prompt_for(website):\n",
|
||||
" user_prompt = f\"\"\"The following text is extracted from a website titled: \"{website.title}\".\n",
|
||||
"\n",
|
||||
"Please analyze this content and provide a short and engaging summary in **Markdown format**.\n",
|
||||
"\n",
|
||||
"If the page contains:\n",
|
||||
"- 🧵 Fashion trends: mention standout styles, designers, or events.\n",
|
||||
"- 🗣️ TV gossip: highlight any drama, casting news, or fan reactions.\n",
|
||||
"- 🎬 Celebrity updates (Hollywood/Bollywood): include relevant quotes, fashion moments, or event mentions.\n",
|
||||
"- 📺 Show recaps: summarize what happened and any major twists.\n",
|
||||
"\n",
|
||||
"Keep the summary clear, fun, and informative. Use bullet points if multiple themes appear. If there is no meaningful content, say: *“No relevant summary could be generated.”*\n",
|
||||
"\n",
|
||||
"Website Content:\n",
|
||||
"{website.text}\n",
|
||||
"\"\"\"\n",
|
||||
" return user_prompt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 127,
|
||||
"id": "5a25e90f-20a0-44ac-a96c-575ae974a45f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"The following text is extracted from a website titled: \"Latest and Trending Entertainment News, Celebrity News, Movie News, Breaking News | Entertainment - Times of India\".\n",
|
||||
"\n",
|
||||
"Please analyze this content and provide a short and engaging summary in **Markdown format**.\n",
|
||||
"\n",
|
||||
"If the page contains:\n",
|
||||
"- 🧵 Fashion trends: mention standout styles, designers, or events.\n",
|
||||
"- 🗣️ TV gossip: highlight any drama, casting news, or fan reactions.\n",
|
||||
"- 🎬 Celebrity updates (Hollywood/Bollywood): include relevant quotes, fashion moments, or event mentions.\n",
|
||||
"- 📺 Show recaps: summarize what happened and any major twists.\n",
|
||||
"\n",
|
||||
"Keep the summary clear, fun, and informative. Use bullet points if multiple themes appear. If there is no meaningful content, say: *“No relevant summary could be generated.”*\n",
|
||||
"\n",
|
||||
"Website Content:\n",
|
||||
"Sign In\n",
|
||||
"TOI\n",
|
||||
"Go to\n",
|
||||
"TOI\n",
|
||||
"Etimes\n",
|
||||
"home\n",
|
||||
"cinema\n",
|
||||
"news\n",
|
||||
"movie reviews\n",
|
||||
"movie listings\n",
|
||||
"box office\n",
|
||||
"anime\n",
|
||||
"previews\n",
|
||||
"did you know\n",
|
||||
"videos\n",
|
||||
"showtimes\n",
|
||||
"blogs\n",
|
||||
"awards\n",
|
||||
"News\n",
|
||||
"entertainment\n",
|
||||
"Trending\n",
|
||||
"Javed Akhtar\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Gauri Khan\n",
|
||||
"Blake Lively\n",
|
||||
"Trisha Krishnan\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Housefull 5\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Sitaare Zameen Par Movie Review\n",
|
||||
"Javed Akhtar\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Gauri Khan\n",
|
||||
"Blake Lively\n",
|
||||
"Trisha Krishnan\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Housefull 5\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Sitaare Zameen Par Movie Review\n",
|
||||
"Javed Akhtar\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Gauri Khan\n",
|
||||
"Blake Lively\n",
|
||||
"Trisha Krishnan\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Housefull 5\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Sitaare Zameen Par Movie Review\n",
|
||||
"Sudhanshu: At 52, John, Dino all of them look like rockstars - EXCLUSIVE\n",
|
||||
"Sudhanshu Pandey, recognized from 'Band Of Boys' and 'Anupama', defies his 50 years with his fitness. He credits his peers like Dino Moria, Arjun Rampal, and John Abraham for inspiring him to maintain a fit and youthful appearance. Pandey also admires Anil Kapoor's energy and dedication, motivating him to continue prioritizing fitness and inspiring others.\n",
|
||||
"Previous\n",
|
||||
"Sonakshi breaks silence on her rift with Luv and Kussh\n",
|
||||
"Madhuri once chased Aamir with hockey stick for THIS reason\n",
|
||||
"Ranbir-Raj Kapoor, Diljit-Hania, Samay-IGL: Top 5 news\n",
|
||||
"Big B's savage reply to troll over cybercrime callertune\n",
|
||||
"Anushka on keeping kids Vamika, Akaay away from public eye\n",
|
||||
"Apoorva Mukhija recalls witnessing gender bias at home\n",
|
||||
"Danish influencer seeks help to find papads from Big B\n",
|
||||
"Sunjay Kapur's reception pics with Priya Sachdev goes viral\n",
|
||||
"Big B schools trolls commenting 'buddha sathiya gaya hai'\n",
|
||||
"Anushka on how she and Virat divide parenting duties\n",
|
||||
"Brahmaji reacts to Vishnu's 7,000-acre land in New Zealand\n",
|
||||
"Diljit says THIS amidst trolling for working with Hania\n",
|
||||
"Riddhi found it ridiculous to like SRK's mother in Jawan\n",
|
||||
"Priya Sachdev once called husband Sunjay Kapur ‘misunderstood’\n",
|
||||
"Next\n",
|
||||
"1\n",
|
||||
"2\n",
|
||||
"3\n",
|
||||
"Hindi\n",
|
||||
"See All\n",
|
||||
"Sudhanshu: At 52, John, Dino all of them look like rockstars - EXCLUSIVE\n",
|
||||
"Sudhanshu Pandey, recognized from 'Band Of Boys' and 'Anupama', defies his 50 years with his fitness. He credits his peers like Dino Moria, Arjun Rampal, and John Abraham for inspiring him to maintain a fit and youthful appearance. Pandey also admires Anil Kapoor's energy and dedication, motivating him to continue prioritizing fitness and inspiring others.\n",
|
||||
"Sonakshi breaks silence on her rift with Luv and Kussh\n",
|
||||
"Madhuri once chased Aamir with hockey stick for THIS reason\n",
|
||||
"Ranbir-Raj Kapoor, Diljit-Hania, Samay-IGL: Top 5 news\n",
|
||||
"Anushka on keeping kids Vamika, Akaay away from public eye\n",
|
||||
"Anushka Sharma and Virat Kohli are committed to shielding their children, Vamika and Akaay, from the constant glare of public attention. In a recent interview, Anushka emphasized the couple's focus on instilling strong values and ensuring a normal upbringing for their kids.\n",
|
||||
"Apoorva Mukhija recalls witnessing gender bias at home\n",
|
||||
"Regional\n",
|
||||
"When Samantha’s class 10 mark sheet got leaked\n",
|
||||
"Throwback to when a nostalgic memory made its way across the internet — Samantha Ruth Prabhu’s Class 10 mark sheet! The actress’s charming on-screen presence and grounded personality were once again in the spotlight as her old school report card began doing the rounds on social media.\n",
|
||||
"Actor Tushar Ghadigaonkar passes away at 34\n",
|
||||
"‘Kuberaa’ Twitter review: Netizens calls it a ‘Blockbuster’\n",
|
||||
"Mammootty’s health- Brittas says actor doing well\n",
|
||||
"Kavya Madhavan’s father P. Madhavan passes away\n",
|
||||
"‘The Raja Saab’ teaser: Prabhas shines in this horror comedy\n",
|
||||
"Mammootty’s father-in-law P S Abu passes away\n",
|
||||
"Videos\n",
|
||||
"See All\n",
|
||||
"Previous\n",
|
||||
"03:07\n",
|
||||
"Ananya Panday’s Garden Bond With Parrots Wins Hearts\n",
|
||||
"88 views | 2 hours ago\n",
|
||||
"03:14\n",
|
||||
"Sameera Reddy’s Healing Journey Through Yoga\n",
|
||||
"31 views | 2 hours ago\n",
|
||||
"03:13\n",
|
||||
"Kriti Kharbanda’s Modern Maharani Look Stuns Instagram\n",
|
||||
"26 views | 2 hours ago\n",
|
||||
"03:12\n",
|
||||
"Bobby Deol Meets Diljit Dosanjh: Punjabi Power Goes Viral\n",
|
||||
"81 views | 2 hours ago\n",
|
||||
"03:19\n",
|
||||
"‘Sitaare Zameen Par’: Riteish Deshmukh’s Emotional Shoutout For Genelia’s Big Win\n",
|
||||
"162 views | 2 hours ago\n",
|
||||
"03:26\n",
|
||||
"Varun Dhawan Stuns With 50 Push-Ups Alongside Army Cadets on Border 2 Set\n",
|
||||
"21 views | 2 hours ago\n",
|
||||
"03:00\n",
|
||||
"VIDYA BALAN TURNS HEADS WITH CASUAL AIRPORT LOOK\n",
|
||||
"16 views | 2 hours ago\n",
|
||||
"03:05\n",
|
||||
"MANDHIRA KAPUR BREAKS DOWN IN EMOTIONAL POST FOR LATE BROTHER SUNJAY KAPUR\n",
|
||||
"1.2K views | 2 hours ago\n",
|
||||
"03:28\n",
|
||||
"SALMAN KHAN TAKES A BRUTAL DIG AT SOHAIL’S DIVORCE ON NATIONAL TV\n",
|
||||
"185 views | 2 hours ago\n",
|
||||
"03:15\n",
|
||||
"RAJINIKANTH CAUSES FAN RIOT DURING ‘JAILER 2’ SHOOT IN MYSORE\n",
|
||||
"26 views | 2 hours ago\n",
|
||||
"03:10\n",
|
||||
"IBRAHIM ALI KHAN KISSES HIS DOG AT AIRPORT IN HEARTWARMING FAREWELL\n",
|
||||
"20 views | 3 hours ago\n",
|
||||
"03:09\n",
|
||||
"ANUPAMAA SET GUTTED IN MASSIVE FIRE | CREW ESCAPES, CINE BODY DEMANDS ACTION\n",
|
||||
"1.2K views | 3 hours ago\n",
|
||||
"Next\n",
|
||||
"1\n",
|
||||
"2\n",
|
||||
"3\n",
|
||||
"4\n",
|
||||
"5\n",
|
||||
"6\n",
|
||||
"7\n",
|
||||
"8\n",
|
||||
"9\n",
|
||||
"10\n",
|
||||
"11\n",
|
||||
"World\n",
|
||||
"See All\n",
|
||||
"Aamir to Tom: Celebs on a mission to 'Save Cinema'\n",
|
||||
"'How to Train Your Dragon' beats '28 Years Later' and 'Elio' to top the US box office on second weekend\n",
|
||||
"Blake Lively is heartbroken after friendship ends with Taylor Swift; accepts the music mogul won't be returning - Deets inside\n",
|
||||
"Selena-Hailey UNFOLLOW each other amid Bieber drama\n",
|
||||
"Judge gives Baldoni access to Blake-Taylor messages\n",
|
||||
"Trending Now\n",
|
||||
"# Sidharth Malhotra-Kiara Advani\n",
|
||||
"# AbRam Khan-Taimur Ali Khan\n",
|
||||
"# Janhvi Kapoor\n",
|
||||
"# Salman Khan\n",
|
||||
"# Hema Malini\n",
|
||||
"# Salman Khan\n",
|
||||
"# Gauri Khan\n",
|
||||
"# Shah Rukh Khan\n",
|
||||
"# Chahatt Khanna\n",
|
||||
"Visual Stories\n",
|
||||
"See All\n",
|
||||
"Previous\n",
|
||||
"Kuberaa’s Sameera to Pushpa’s Srivalli: Rashmika Mandanna’s most iconic on-screen avatars\n",
|
||||
"Ahaana Krishna’s ethereal photo series is straight out of a dream\n",
|
||||
"Rashmika Mandanna to Rakul Preet Singh: Best pictures of the week featuring south actresses\n",
|
||||
"Gauri Khan's most loved saree looks - An ode to modern day elegance\n",
|
||||
"South Indian beauties whose smiles will light up your Monday\n",
|
||||
"Karishma Tanna Slays Every Frame\n",
|
||||
"Tamannaah Bhatia’s traditional looks\n",
|
||||
"Malavika Mohanan's radiant pics\n",
|
||||
"Neha Shetty stuns in every shade of blue\n",
|
||||
"Thalapathy Vijay’s top 10 blockbuster movies worth re-watching!\n",
|
||||
"In pic: Mesmerizing looks of Shruti Haasan\n",
|
||||
"Dushara Vijayan’s Most Elegant Fashion Moments\n",
|
||||
"Next\n",
|
||||
"1\n",
|
||||
"2\n",
|
||||
"3\n",
|
||||
"More Stories\n",
|
||||
"Sonakshi Sinha breaks silence on her rumoured rift with brothers Luv and Kussh Sinha: 'My effort is always to support them...'\n",
|
||||
"Madhuri Dixit once chased Aamir Khan with a hockey stick for THIS reason on sets of Dil: 'People fool you and you believe them'\n",
|
||||
"Mohanlal declines to continue as president at AMMA’s general body meeting- Deets Inside\n",
|
||||
"Blockbusters Ranbir Kapoor turned down: Films that became hits without him\n",
|
||||
"Anushka Sharma reveals why she and Virat Kohli are keeping their children Vamika and Akaay away from the public eye: 'We don't want to raise brats'\n",
|
||||
"Apoorva Mukhija recalls witnessing gender bias at home: 'My mother did it all, but father got credit for showing up at PTMs'\n",
|
||||
"Amitabh Bachchan gives a savage reply to a troll over his viral cybercrime caller tune: 'Sarkar ko bolo bhai..'\n",
|
||||
"Danish influencer asks fans to help her find papads from Amitabh Bachchan; netizens say 'he also used to grow basmati rice'\n",
|
||||
"Days after his untimely demise, Sunjay Kapur's reception photos with Priya Sachdev goes viral; Looked dashing in hand embroidered shoes, written 'I do'\n",
|
||||
"Priyanka Chopra Jonas recollects walking into a trap set by John Cena, Idris Elba on sets of 'Heads of State'\n",
|
||||
"Bobby Deol's London vacation sparks fan frenzy: viral video shows actor posing for selfies outside restaurant\n",
|
||||
"Amitabh Bachchah gives befitting replies to 'buddha sathiya gaya hai', ‘ganja’ comments by trolls: 'Ek din, Bhagwan naa kare voh din jaldi aaye...'\n",
|
||||
"Sai Pallavi’s best performances\n",
|
||||
"Brahmaji clears the air about Vishnu Manchu purchasing 7,000-acre land in New Zealand: 'I was pulling their leg as usual...'\n",
|
||||
"Anushka Sharma reveals how she and Virat Kohli divide the parenting duties: 'I will be the primary caregiver, he plays round the year'\n",
|
||||
"Ranbir Kapoor's 'Awara' look sparks rumours of Raj Kapoor tribute, Diljit Dosanjh slammed for working with Hania Aamir in Sardaar Ji 3: Top 5 news\n",
|
||||
"Has Kiara Advani been approached to play Meena Kumari in her biopic? Here's what we know\n",
|
||||
"Top 5 psychological Anime every thriller fan must watch\n",
|
||||
"Load More Stories\n",
|
||||
"# Latest Movies 2025\n",
|
||||
"# Best Bollywood Movies 2025\n",
|
||||
"# Hollywood Movie 2025\n",
|
||||
"# Tamil Movies 2025\n",
|
||||
"# Telugu Movies 2025\n",
|
||||
"# Malayalam Movies 2025\n",
|
||||
"# Kannada Movies 2025\n",
|
||||
"# Marathi Movies 2025\n",
|
||||
"# Bengali Movies 2025\n",
|
||||
"# Top Rated Movies 2025\n",
|
||||
"# Best Hindi Movies\n",
|
||||
"# Best English Movies\n",
|
||||
"Hot on the Web\n",
|
||||
"Salman Khan\n",
|
||||
"Karisma Kapoor\n",
|
||||
"Jaideep Ahlawat\n",
|
||||
"Blood Pressure\n",
|
||||
"Big Cat Species\n",
|
||||
"Trisha\n",
|
||||
"Sitaare Zameen Par Review\n",
|
||||
"Ancient Indigenous Tribes\n",
|
||||
"Hair Growth Tips\n",
|
||||
"Kidney Health\n",
|
||||
"Kuberaa Review\n",
|
||||
"Blake Lively\n",
|
||||
"Reverse Fatty Liver\n",
|
||||
"Skincare Hacks\n",
|
||||
"Kuberaa Box Office Collection\n",
|
||||
"Sitaare Zameen Par Box Office Collection\n",
|
||||
"Baby Girl Names\n",
|
||||
"Diljit Dosanjh\n",
|
||||
"Kidney Disease Symptoms\n",
|
||||
"Javed Akhtar\n",
|
||||
"Heart Attack\n",
|
||||
"Ram Kapoor Diet\n",
|
||||
"Liver Damage\n",
|
||||
"Kuberaa Movie Review\n",
|
||||
"Gauri Khan\n",
|
||||
"Baba Vanga Prediction\n",
|
||||
"Baby Boy Names\n",
|
||||
"Navjot Singh Sidhu\n",
|
||||
"Housefull 5 Box Office Collection\n",
|
||||
"DNA Movie Review\n",
|
||||
"Kidney Damage Symptoms\n",
|
||||
"Popular Waterfalls In India\n",
|
||||
"Linkedin Ceo On AI Killing Jobs\n",
|
||||
"Tesla Robotaxi\n",
|
||||
"Early Cancer Detection\n",
|
||||
"Harvard Research Reveals\n",
|
||||
"American Destinations Explore Without Passport\n",
|
||||
"Amouranth\n",
|
||||
"Mouth Larvae\n",
|
||||
"Doomsday Fish\n",
|
||||
"Salman Khan AVM\n",
|
||||
"Ginger Health Tips\n",
|
||||
"Trending Topics\n",
|
||||
"Latest Movies\n",
|
||||
"Bollywood Movies\n",
|
||||
"Hollywood Movies\n",
|
||||
"Tamil Movies 2025\n",
|
||||
"Telugu Movies 2025\n",
|
||||
"Malayalam Movies 2025\n",
|
||||
"Kannada Movies 2025\n",
|
||||
"Marathi Movies 2025\n",
|
||||
"Bengali Movies 2025\n",
|
||||
"Top Rated Movies 2025\n",
|
||||
"Best Hindi Movies\n",
|
||||
"Best English Movies\n",
|
||||
"Best Telugu Movies\n",
|
||||
"Best Tamil Movies\n",
|
||||
"Best Malayalam Movies\n",
|
||||
"Best Kannada Movies\n",
|
||||
"Best Bengali Movies\n",
|
||||
"Upcoming Hindi Movies\n",
|
||||
"Best Movies Of All Time\n",
|
||||
"Best Hindi Movies of All Time\n",
|
||||
"Latest English Movies\n",
|
||||
"Latest Malayalam Movies\n",
|
||||
"English TV News\n",
|
||||
"Tamil TV News\n",
|
||||
"Telugu TV News\n",
|
||||
"Malayalam TV News\n",
|
||||
"Kannada TV News\n",
|
||||
"Movie Reviews\n",
|
||||
"Bhojpuri Cinema News\n",
|
||||
"Gujarati Cinema News\n",
|
||||
"Popular Categories\n",
|
||||
"Viral News\n",
|
||||
"K Pop News\n",
|
||||
"Web Series News\n",
|
||||
"Anime News\n",
|
||||
"Upcoming English Movies\n",
|
||||
"Upcoming Tamil Movies\n",
|
||||
"Upcoming Telugu Movies\n",
|
||||
"Upcoming Malayalam Movies\n",
|
||||
"Upcoming Kannada Movies\n",
|
||||
"Fashion Tips\n",
|
||||
"Travel News\n",
|
||||
"Entertainment News\n",
|
||||
"Bollywood News\n",
|
||||
"Tollywood News\n",
|
||||
"Kollywood News\n",
|
||||
"Mollywood News\n",
|
||||
"Food News\n",
|
||||
"Latest Hindi Movies\n",
|
||||
"Latest Tamil Movies\n",
|
||||
"Parenting Tips\n",
|
||||
"Home Remedies\n",
|
||||
"Weight Loss\n",
|
||||
"Beauty Tips\n",
|
||||
"Parenting Tips\n",
|
||||
"Hindi Videos\n",
|
||||
"Hindi Video Songs\n",
|
||||
"Bhojpuri Music Videos\n",
|
||||
"Latest Telugu Movies\n",
|
||||
"Bhojpuri Music Video\n",
|
||||
"Hindi TV News\n",
|
||||
"Latest News\n",
|
||||
"NHL free agency turns spicy as Mitch Marner and Connor McDavid eye shorter deals to cash in later\n",
|
||||
"Olive Ridley turtle washed ashore at Polem\n",
|
||||
"Who is Thomas Fugate? Meet the 22-year-old leading Trump's terrorism unit amid Iran fiasco\n",
|
||||
"'And that's why Putin's the boss': Trump rebukes former Russian President Medvedev; warns against treating 'N word casually'\n",
|
||||
"Govt plans ₹10cr road on Bicholim-Dodamarg route\n",
|
||||
"Former WWE star Batista eyed for Road House 2 sequel\n",
|
||||
"Sonakshi Sinha breaks silence on her rumoured rift with brothers Luv and Kussh Sinha: 'My effort is always to support them...'\n",
|
||||
"Andre Agassi and Steffi Graf’s son Jaden Agassi shows love for girlfriend Catherine Holt’s bold new photo from bedroom series\n",
|
||||
"Is WWE planning to change Cody Rhodes’ iconic entrance theme song ‘Kingdom’?\n",
|
||||
"Velumani says he didn’t attend RSS event in Coimbatore\n",
|
||||
"Strait of Hormuz: Oil supply not an issue for India; 'pricing is a bigger concern,' what experts say\n",
|
||||
"Madhuri Dixit once chased Aamir Khan with a hockey stick for THIS reason on sets of Dil: 'People fool you and you believe them'\n",
|
||||
"As commissions fall, India’s ride-hailing firms test viability of flat-fee economics\n",
|
||||
"Analysing what Trump’s strikes mean for Iran\n",
|
||||
"Trump's clarification on 'Iran regime change' divides MAGA further: JD Vance, Hegseth, Marco Rubio 'humiliated'\n",
|
||||
"Laughter Chefs 2: Krushna Abhishek roasts Rahul Vaidya for his in-famous feud with cricketer Virat Kohli\n",
|
||||
"“I could have passed Dan Ticktum”: Edoardo Mortara regrets Attack Mode strategy at Jakarta E-Prix\n",
|
||||
"India vs England Test: Sunil Gavaskar calls for Rishabh Pant's signature somersault celebration, wicketkeeper politely declines - WATCH\n",
|
||||
"Copyright © 2025 Bennett, Coleman & Co. Ltd. All rights reserved. For reprint rights: Times Syndication Service\n",
|
||||
"Follow us on\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(user_prompt_for(gossip))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 129,
|
||||
"id": "c039ab7c-88ee-475d-a93e-b26711d3ed4b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def messages_for(website):\n",
|
||||
" return [\n",
|
||||
" {\"role\": \"system\", \"content\": system_prompt},\n",
|
||||
" {\"role\": \"user\", \"content\": user_prompt_for(website)}\n",
|
||||
" ]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 146,
|
||||
"id": "dd1fee35-6cc9-4995-8b5e-b93d80488364",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def summarize(url):\n",
|
||||
" website = Website(url)\n",
|
||||
" response = openai.chat.completions.create(\n",
|
||||
" model = \"llama3.2\",\n",
|
||||
" messages = messages_for(website)\n",
|
||||
" )\n",
|
||||
" return response.choices[0].message.content"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ed09dad8-93bb-417e-b07b-183d2eba1ec5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"summarize(\"https://timesofindia.indiatimes.com/entertainment\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 139,
|
||||
"id": "16a57eed-eba5-4f75-84f2-d44a67b36047",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def display_summary(url):\n",
|
||||
" summary = summarize(url)\n",
|
||||
" display(Markdown(summary))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "25af6217-6944-4c95-b156-0899dfcf0b83",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"display_summary(\"https://timesofindia.indiatimes.com/entertainment\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "29daa2d4-9d92-40ae-a0c4-dd2fdacf3f80",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.12.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user