Browse Source

remove unwanted comments

pull/124/head
266367 3 months ago
parent
commit
b9723acee1
  1. 8
      week1/community-contributions/wk1-day1-deepseek-stream-summarize.ipynb

8
week1/community-contributions/wk1-day1-deepseek-stream-summarize.ipynb

@ -13,12 +13,11 @@
"from bs4 import BeautifulSoup\n",
"from IPython.display import Markdown, display, clear_output\n",
"from openai import OpenAI\n",
"import time\n",
"\n",
"load_dotenv(override=True)\n",
"api_key = os.getenv('DEEPSEEK_API_KEY')\n",
"base_url=os.getenv('DEEPSEEK_BASE_URL')\n",
"start_time = time.time()\n",
"MODEL = \"deepseek-chat\"\n",
"\n",
"system_prompt = \"You are an assistant that analyzes the contents of a website \\\n",
"and provides a short summary, ignoring text that might be navigation related. \\\n",
@ -74,7 +73,7 @@
"def summarize(url):\n",
" website = Website(url)\n",
" response = openai.chat.completions.create(\n",
" model=\"deepseek-chat\",\n",
" model=MODEL,\n",
" messages=messages_for(website),\n",
" stream=True\n",
" )\n",
@ -85,9 +84,6 @@
" accumulated_content += chunk.choices[0].delta.content # Append the chunk to the accumulated content\n",
" clear_output(wait=True) # Clear the previous output\n",
" display(Markdown(accumulated_content)) # Display the updated content\n",
" \n",
" # # Final display (optional, as the loop already displays the content)\n",
" # display(Markdown(accumulated_content))\n",
"\n",
"def display_summary():\n",
" url = str(input(\"Enter the URL of the website you want to summarize: \"))\n",

Loading…
Cancel
Save