TCares commited on
Commit
eac5218
·
verified ·
1 Parent(s): bc634f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -22
app.py CHANGED
@@ -33,27 +33,27 @@ def find_job_websites(job:str, location:str)-> str:
33
  visit_webpage = VisitWebpageTool()
34
 
35
 
36
- # 2. Text Summarizer
37
- summarizer = pipeline("summarization", model="Falconsai/text_summarization")
38
- def text_summarizer(text: str) -> str:
39
- try:
40
- summary = summarizer(text, max_length=1000, min_length=20, do_sample=False)
41
- return summary[0]['summary_text']
42
- except Exception as e:
43
- return f"Error in summarization: {str(e)}"
44
-
45
- @tool
46
- def visit_webpage_summarization(url:str)-> str:
47
- """A tool that visits a webpage at the given url and, reads its content as a markdown string,
48
- and extracts relevant information. Use this to browse webpages.
49
- Args:
50
- url: The url of the webpage to visit.
51
- Returns:
52
- A summarization containing all relevant information about the webpage's content.
53
- """
54
- content = visit_webpage(url)
55
-
56
- return text_summarizer(content)
57
 
58
  @tool
59
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -92,7 +92,6 @@ agent = CodeAgent(
92
  model=model,
93
  tools=[
94
  find_job_websites,
95
- visit_webpage_summarization,
96
  final_answer
97
  ],
98
  max_steps=MAX_STEPS,
 
33
  visit_webpage = VisitWebpageTool()
34
 
35
 
36
+ ## 2. Text Summarizer
37
+ #summarizer = pipeline("summarization", model="Falconsai/text_summarization")
38
+ #def text_summarizer(text: str) -> str:
39
+ # try:
40
+ # summary = summarizer(text, max_length=1000, min_length=20, do_sample=False)
41
+ # return summary[0]['summary_text']
42
+ # except Exception as e:
43
+ # return f"Error in summarization: {str(e)}"
44
+
45
+ #@tool
46
+ #def visit_webpage_summarization(url:str)-> str:
47
+ # """A tool that visits a webpage at the given url and, reads its content as a markdown string,
48
+ # and extracts relevant information. Use this to browse webpages.
49
+ # Args:
50
+ # url: The url of the webpage to visit.
51
+ # Returns:
52
+ # A summarization containing all relevant information about the webpage's content.
53
+ # """
54
+ # content = visit_webpage(url)
55
+ #
56
+ # return text_summarizer(content)
57
 
58
  @tool
59
  def get_current_time_in_timezone(timezone: str) -> str:
 
92
  model=model,
93
  tools=[
94
  find_job_websites,
 
95
  final_answer
96
  ],
97
  max_steps=MAX_STEPS,