Raghavan1988 commited on
Commit
62123f4
1 Parent(s): 56d3408

updated prompt to generate summary and takeaway with bug fixes

Browse files
Files changed (1) hide show
  1. app.py +26 -22
app.py CHANGED
@@ -54,30 +54,34 @@ def generate(
54
  )
55
  seed = seed + 1
56
 
57
- arxiv_key = prompt.strip().split(".")
58
- if len(arxiv_key) <= 2:
59
- output = "Please enter a valid arXiv ID."
60
- return output
61
-
62
-
63
- arxiv_id = prompt
64
- docs = ArxivLoader(query="1605.08386", load_max_docs=2).load()
65
- doc = docs[0]
66
-
67
- title = doc["Title"]
68
- abstract = doc["Summary"]
69
- authors = doc["Authors"]
70
- published = doc["Published"]
71
-
72
- prompt = "You are a RESEARCH Assistant, who is tasked with Summarizing a scholarly research article paper. You are given the following information:\n"
73
- prompt += f"Title: {title}\n"
74
- prompt += f"Authors: {authors}\n"
75
- prompt += f"Published: {published}\n"
76
- prompt += f"Abstract: {abstract}\n"
77
- prompt += f"Your task is to summarize the paper in 3-4 bullet points, generating key takeaways \n"
78
- prompt += f"Generate a FUTURE IDEA for the paper, that can be used to extend the paper. \n"
79
 
 
 
 
 
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  formatted_prompt = format_prompt(prompt, history, system_prompt)
82
 
83
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
 
54
  )
55
  seed = seed + 1
56
 
57
+ try:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
+ arxiv_key = prompt.strip().split(".")
60
+ if len(arxiv_key) <= 2:
61
+ output = "Please enter a valid arXiv ID."
62
+ return output
63
 
64
+
65
+ arxiv_id = prompt
66
+ docs = ArxivLoader(query="1605.08386", load_max_docs=2).load()
67
+ doc = docs[0]
68
+
69
+ title = doc["Title"]
70
+ abstract = doc["Summary"]
71
+ authors = doc["Authors"]
72
+ published = doc["Published"]
73
+
74
+ prompt = "You are a RESEARCH Assistant, who is tasked with Summarizing a scholarly research article paper. You are given the following information:\n"
75
+ prompt += f"Title: {title}\n"
76
+ prompt += f"Authors: {authors}\n"
77
+ prompt += f"Published: {published}\n"
78
+ prompt += f"Abstract: {abstract}\n"
79
+ prompt += f"Your task is to summarize the paper in 3-4 bullet points, generating key takeaways \n"
80
+ prompt += f"Generate a FUTURE IDEA for the paper, that can be used to extend the paper. \n"
81
+
82
+ except Exception as e:
83
+ print(Exception + " " + e)
84
+ prompt = "How can you help me with research."
85
  formatted_prompt = format_prompt(prompt, history, system_prompt)
86
 
87
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)