tamilprabaharan commited on
Commit
fa6ef1d
·
verified ·
1 Parent(s): 5120b41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -15
app.py CHANGED
@@ -13,27 +13,49 @@ from Gradio_UI import GradioUI
13
  @tool
14
  def search_latest_ai_models(topic: str) -> str:
15
  """
16
- Uses DuckDuckGo to search for the latest AI/GenAI advancements and returns it in tabular format.
17
-
18
- Args:
19
- topic: The topic to search, e.g., "latest AI models June 2025"
20
 
 
 
21
  Returns:
22
- A markdown table of recent AI model announcements, their creators, purposes, and benefits.
23
  """
24
  search_tool = DuckDuckGoSearchTool()
25
  results = search_tool(topic)
26
 
27
- # Example post-processing (this can be replaced by better parsing in real-time)
28
- # Dummy entries for now (you can customize parsing later)
29
- table_data = [
30
- {"Model": "Qwen 2.5", "Company": "Alibaba", "Purpose": "Code generation", "Benefit": "Improved coding accuracy"},
31
- {"Model": "Gemini 1.5", "Company": "Google DeepMind", "Purpose": "Multi-modal reasoning", "Benefit": "Handles longer context, integrates video"},
32
- {"Model": "Veo 2", "Company": "Google", "Purpose": "Text-to-video", "Benefit": "High-fidelity, longer videos"},
33
- ]
34
-
35
- df = pd.DataFrame(table_data)
36
- return df.to_markdown(index=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  @tool
39
  def get_current_time_in_timezone(timezone: str) -> str:
 
13
  @tool
14
  def search_latest_ai_models(topic: str) -> str:
15
  """
16
+ Searches for latest AI/GenAI model announcements using DuckDuckGo and returns results in tabular format.
 
 
 
17
 
18
+ Args:
19
+ topic: Topic to search (e.g., 'latest Generative AI models 2025')
20
  Returns:
21
+ Markdown table summarizing AI model, company, and purpose.
22
  """
23
  search_tool = DuckDuckGoSearchTool()
24
  results = search_tool(topic)
25
 
26
+ # Process first 5 results only for simplicity
27
+ table_data = []
28
+ for item in results[:5]:
29
+ # Try to split headline to get a rough model and org
30
+ title = item.get("title", "")
31
+ link = item.get("link", "")
32
+ snippet = item.get("body", "")
33
+
34
+ model = title.split(" ")[0]
35
+ company = "Unknown"
36
+ if "Google" in snippet or "Google" in title:
37
+ company = "Google"
38
+ elif "OpenAI" in snippet or "OpenAI" in title:
39
+ company = "OpenAI"
40
+ elif "Anthropic" in snippet or "Anthropic" in title:
41
+ company = "Anthropic"
42
+ elif "Alibaba" in snippet or "Alibaba" in title:
43
+ company = "Alibaba"
44
+
45
+ table_data.append({
46
+ "Model": model,
47
+ "Company": company,
48
+ "Purpose": snippet[:100] + "..." if snippet else "N/A",
49
+ "Link": link
50
+ })
51
+
52
+ # Convert to markdown table
53
+ markdown = "| Model | Company | Purpose | Link |\n|-------|---------|---------|------|\n"
54
+ for row in table_data:
55
+ markdown += f"| {row['Model']} | {row['Company']} | {row['Purpose']} | [Link]({row['Link']}) |\n"
56
+
57
+ return markdown
58
+
59
 
60
  @tool
61
  def get_current_time_in_timezone(timezone: str) -> str: