Shreyas094 commited on
Commit
4eae458
·
verified ·
1 Parent(s): fbdf42e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from duckduckgo_search import DDGS
3
  from typing import List, Dict
4
 
5
- def get_web_search_results(query: str, max_results: int = 5) -> List[Dict[str, str]]:
6
  try:
7
  results = DDGS().text(query, max_results=max_results)
8
  return list(results) # Convert generator to list
@@ -15,7 +15,7 @@ def summarize_results(query: str, search_results: List[Dict[str, str]]) -> str:
15
  context = "\n\n".join([f"Title: {result['title']}\nContent: {result['body']}" for result in search_results])
16
 
17
  # Prepare the prompt for the chat
18
- prompt = f"Based on the following web search results about '{query}', please provide a concise summary:\n\n{context}\n\nSummary:"
19
 
20
  # Get summary from DuckDuckGo Chat
21
  summary = DDGS().chat(prompt, model='claude-3-haiku')
 
2
  from duckduckgo_search import DDGS
3
  from typing import List, Dict
4
 
5
+ def get_web_search_results(query: str, max_results: int = 10) -> List[Dict[str, str]]:
6
  try:
7
  results = DDGS().text(query, max_results=max_results)
8
  return list(results) # Convert generator to list
 
15
  context = "\n\n".join([f"Title: {result['title']}\nContent: {result['body']}" for result in search_results])
16
 
17
  # Prepare the prompt for the chat
18
+ prompt = f"Based on the following web search results about '{query}', please provide detailed news article and also make sure to list down all the sources at the end:\n\n{context}\n\nArticle:"
19
 
20
  # Get summary from DuckDuckGo Chat
21
  summary = DDGS().chat(prompt, model='claude-3-haiku')