Ahmet Zelka commited on
Commit
26d3ef0
·
verified ·
1 Parent(s): da1c673

Fixed wrong function calling

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -27,7 +27,7 @@ def paper_finder(topics:list, max_paper:int)-> str: #it's import to specify the
27
 
28
  try:
29
  response = requests.get(url)
30
- if response.get_status == 200:
31
  # parsing element tree as text
32
  root = ET.from_string(response.text)
33
 
@@ -48,28 +48,28 @@ def paper_finder(topics:list, max_paper:int)-> str: #it's import to specify the
48
  else:
49
  pdf_url = "No PDF link available"
50
 
51
- # Authors of the paper
52
- authors = []
53
- for author in entry.findall('atom:author/atom:name', namespace):
54
- authors.append(author.text.strip())
55
-
56
- # Adding paper
57
- papers.append({
58
- "title": title,
59
- "authors": ", ".join(authors[:3]) + ("..." if len(authors) > 3 else ""),
60
- "published": published,
61
- "summary": summary[:150] + "..." if len(summary) > 150 else summary,
62
- "pdf_url": pdf_url
63
- })
64
-
65
- for i, paper in enumerate(papers, 1):
66
- topic_results += f"{i}. **{paper['title']}**\n"
67
- topic_results += f" *Authors:* {paper['authors']}\n"
68
- topic_results += f" *Published:* {paper['published']}\n"
69
- topic_results += f" *Summary:* {paper['summary']}\n"
70
- topic_results += f" *PDF:* {paper['pdf_url']}\n\n"
71
 
72
- results.append(topic_results)
73
 
74
  else:
75
  print(f"An error occured when requesting for {query}, please try again!")
 
27
 
28
  try:
29
  response = requests.get(url)
30
+ if response.status_code == 200:
31
  # parsing element tree as text
32
  root = ET.from_string(response.text)
33
 
 
48
  else:
49
  pdf_url = "No PDF link available"
50
 
51
+ # Authors of the paper
52
+ authors = []
53
+ for author in entry.findall('atom:author/atom:name', namespace):
54
+ authors.append(author.text.strip())
55
+
56
+ # Adding paper
57
+ papers.append({
58
+ "title": title,
59
+ "authors": ", ".join(authors[:3]) + ("..." if len(authors) > 3 else ""),
60
+ "published": published,
61
+ "summary": summary[:150] + "..." if len(summary) > 150 else summary,
62
+ "pdf_url": pdf_url
63
+ })
64
+
65
+ for i, paper in enumerate(papers, 1):
66
+ topic_results += f"{i}. **{paper['title']}**\n"
67
+ topic_results += f" *Authors:* {paper['authors']}\n"
68
+ topic_results += f" *Published:* {paper['published']}\n"
69
+ topic_results += f" *Summary:* {paper['summary']}\n"
70
+ topic_results += f" *PDF:* {paper['pdf_url']}\n\n"
71
 
72
+ results.append(topic_results)
73
 
74
  else:
75
  print(f"An error occured when requesting for {query}, please try again!")