Spaces:
Runtime error
Runtime error
pritamdeka
commited on
Commit
Β·
95e9c38
1
Parent(s):
e736e68
Update app.py
Browse files
app.py
CHANGED
@@ -251,15 +251,16 @@ def keyphrase_generator(article_link, model_1, model_2, max_num_keywords, model_
|
|
251 |
for list_elem in sorted_titles:
|
252 |
sorted_abstract_list.append(my_dict[list_elem])
|
253 |
sorted_dict = {'Title': sorted_titles, 'Abstract': sorted_abstract_list}
|
254 |
-
df_new=pd.DataFrame(dict([ (k,pd.Series(v)) for k,v in sorted_dict.items() ]))
|
255 |
-
|
256 |
df_final = df_new.fillna(' ')
|
|
|
257 |
|
258 |
|
259 |
############################################# Ends here ####################################################
|
260 |
|
261 |
#return df_final
|
262 |
-
return
|
|
|
263 |
|
264 |
|
265 |
igen_pubmed = gr.Interface(keyphrase_generator,
|
@@ -308,7 +309,8 @@ igen_pubmed = gr.Interface(keyphrase_generator,
|
|
308 |
default='pritamdeka/S-Biomed-Roberta-snli-multinli-stsb',
|
309 |
label="Select any SBERT model for abstracts from the list below")],
|
310 |
#outputs=gr.outputs.Dataframe(type="auto", label="Retrieved Results from PubMed",max_cols=2, overflow_row_behaviour="paginate"),
|
311 |
-
outputs=gr.outputs.JSON(label=None),
|
|
|
312 |
theme="peach", layout="horizontal",
|
313 |
title="PubMed Abstract Retriever", description="Retrieves relevant PubMed abstracts for an online article which can be used as further references. The output is in the form of JSON with <b><i>Titles</i></b> and <b><i>Abstracts</i></b>. Please note that it may take sometime for the models to load. Examples are provided below for demo purposes. Choose any one example to see the results. The models can be changed to see different results. ",
|
314 |
examples=[
|
|
|
251 |
for list_elem in sorted_titles:
|
252 |
sorted_abstract_list.append(my_dict[list_elem])
|
253 |
sorted_dict = {'Title': sorted_titles, 'Abstract': sorted_abstract_list}
|
254 |
+
df_new=pd.DataFrame(dict([ (k,pd.Series(v)) for k,v in sorted_dict.items() ]))
|
|
|
255 |
df_final = df_new.fillna(' ')
|
256 |
+
fp = df_final_to_csv('title_abstract.csv', index=False)
|
257 |
|
258 |
|
259 |
############################################# Ends here ####################################################
|
260 |
|
261 |
#return df_final
|
262 |
+
return fp
|
263 |
+
#return sorted_dict
|
264 |
|
265 |
|
266 |
igen_pubmed = gr.Interface(keyphrase_generator,
|
|
|
309 |
default='pritamdeka/S-Biomed-Roberta-snli-multinli-stsb',
|
310 |
label="Select any SBERT model for abstracts from the list below")],
|
311 |
#outputs=gr.outputs.Dataframe(type="auto", label="Retrieved Results from PubMed",max_cols=2, overflow_row_behaviour="paginate"),
|
312 |
+
#outputs=gr.outputs.JSON(label=None),
|
313 |
+
outputs=gr.outputs.File(label=None),
|
314 |
theme="peach", layout="horizontal",
|
315 |
title="PubMed Abstract Retriever", description="Retrieves relevant PubMed abstracts for an online article which can be used as further references. The output is in the form of JSON with <b><i>Titles</i></b> and <b><i>Abstracts</i></b>. Please note that it may take sometime for the models to load. Examples are provided below for demo purposes. Choose any one example to see the results. The models can be changed to see different results. ",
|
316 |
examples=[
|