|
import oneclass |
|
import Cosine_distance |
|
import gradio as gr |
|
import pandas as pd |
|
from io import StringIO |
|
|
|
def predict_and_download(classifier_oneclass_or_Cosine_distance ,positive_csv_file, unlabelled_csv_file, n,Hyperparameter_nu): |
|
if choice == "oneclass" : |
|
selected_paper_info = oneclass.select_top_n_papers(n, positive_csv_file, unlabelled_csv_file,Hyperparameter_nu) |
|
else : |
|
selected_paper_info = Cosine_distance.recommend_papers(positive_csv_file, positive_csv_file, n) |
|
|
|
|
|
csv_buffer = StringIO() |
|
|
|
|
|
selected_paper_info.to_csv(csv_buffer, index=False) |
|
|
|
|
|
csv_content = csv_buffer.getvalue() |
|
|
|
|
|
|
|
return selected_paper_info, csv_buffer |
|
|
|
|
|
iface = gr.Interface( |
|
fn=predict_and_download, |
|
inputs=["text","file", "file", "number","number"], |
|
outputs=[gr.DataFrame(label="Recommended Papers"), gr.DownloadButton(label="Download CSV")], |
|
title="Personalized Arxiv Feed", |
|
description="Enter text and upload CSV files for labelled and unlabelled data.", |
|
allow_flagging='never' |
|
) |
|
|
|
iface.launch() |