Spaces:
Runtime error
Runtime error
pritamdeka
commited on
Commit
Β·
12638e1
1
Parent(s):
01f5167
Update app.py
Browse files
app.py
CHANGED
@@ -210,51 +210,35 @@ def keyphrase_generator(article_link, model_1, model_2, max_num_keywords):
|
|
210 |
final_list.append(f_1)
|
211 |
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
for
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
journal_list.append(value_journal)
|
243 |
-
mydict={'Title': title_list, 'Abstract':abstract_list, 'Journal Title': journal_list, 'Year': year_list}
|
244 |
-
df_new=pd.DataFrame(mydict)
|
245 |
-
#print(df_new)
|
246 |
-
#else:
|
247 |
-
# abstract_list=[]
|
248 |
-
# title_list=[]
|
249 |
-
# year_list=[]
|
250 |
-
# journal_list=[]
|
251 |
-
# a=["No result"]
|
252 |
-
# b=["No results"]
|
253 |
-
# abstract_list.append(a)
|
254 |
-
# title_list.append(b)
|
255 |
-
# mydict={'Title': title_list, 'Abstract':abstract_list, 'Journal Title': journal_list, 'Year': year_list}
|
256 |
-
# df_new=pd.DataFrame(mydict)
|
257 |
-
#print(df_new)
|
258 |
return title_list
|
259 |
|
260 |
gr.Interface(keyphrase_generator,
|
|
|
210 |
final_list.append(f_1)
|
211 |
|
212 |
|
213 |
+
ncbi_url='https://eutils.ncbi.nlm.nih.gov/entrez/eutils/'
|
214 |
+
|
215 |
+
last_url='esearch.fcgi?db=pubmed'+'&term='+f_1
|
216 |
+
search_rettype = '&rettype=json'
|
217 |
+
overall_url=ncbi_url+last_url+search_rettype+'&sort=relevance'
|
218 |
+
r = requests.get(overall_url)
|
219 |
+
|
220 |
+
root = ET.fromstring(r.text)
|
221 |
+
levels = root.findall('.//Id')
|
222 |
+
name_list=[]
|
223 |
+
for level in levels:
|
224 |
+
name = level.text
|
225 |
+
name_list.append(name)
|
226 |
+
name_1 = ','.join(name_list)
|
227 |
+
fetch_url='efetch.fcgi?db=pubmed'
|
228 |
+
search_id='&id='+name_1
|
229 |
+
ret_type='&rettype=text'
|
230 |
+
ret_mode='&retmode=xml'
|
231 |
+
ret_max='&retmax=10'
|
232 |
+
ret_sort='&sort=relevance'
|
233 |
+
return_url=ncbi_url+fetch_url+search_id+ret_type+ret_mode+ret_max+ret_sort
|
234 |
+
r_1 = requests.get(return_url)
|
235 |
+
root_1 = ET.fromstring(r_1.text)
|
236 |
+
levels_1 = root_1.findall('.//ArticleTitle')
|
237 |
+
for level in levels_1:
|
238 |
+
name = level.text
|
239 |
+
title_list.append(name)
|
240 |
+
|
241 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
return title_list
|
243 |
|
244 |
gr.Interface(keyphrase_generator,
|