BroBro87 commited on
Commit
beeefa7
·
verified ·
1 Parent(s): 3333dc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -27,8 +27,9 @@ def find_hackernews_posts(message,history):
27
  description=f"""
28
  Use the serp tool to search for the user's twitter profile of name {profile} to read his bio,
29
  and then scrape it. Based on his bio, find good technical hackernews posts suited to his bio.
 
30
  """,
31
- expected_output="A list of technical hackernews posts printed",
32
  agent=hacnews_agent,
33
  tools=tools
34
  )
@@ -41,7 +42,14 @@ def find_hackernews_posts(message,history):
41
  )
42
 
43
  result = crew.kickoff()
44
- return result
 
 
 
 
 
 
 
45
 
46
  chat_interface = gr.ChatInterface(
47
  fn=find_hackernews_posts,
 
27
  description=f"""
28
  Use the serp tool to search for the user's twitter profile of name {profile} to read his bio,
29
  and then scrape it. Based on his bio, find good technical hackernews posts suited to his bio.
30
+ Return a list of 5 posts, each with a title and URL.
31
  """,
32
+ expected_output="A list of 5 technical hackernews posts with titles and URLs",
33
  agent=hacnews_agent,
34
  tools=tools
35
  )
 
42
  )
43
 
44
  result = crew.kickoff()
45
+
46
+ # Parse the result and format it for Gradio
47
+ formatted_result = "Here are some relevant Hacker News posts:\n\n"
48
+ for post in result.split('\n'):
49
+ if post.strip():
50
+ formatted_result += f"• {post.strip()}\n"
51
+
52
+ return formatted_result
53
 
54
  chat_interface = gr.ChatInterface(
55
  fn=find_hackernews_posts,