import oneclass import gradio as gr import pandas as pd import io def predict_and_download(positive_csv_file, unlabelled_csv_file, n, text): selected_paper_info = oneclass.select_top_n_papers(n, positive_csv_file, unlabelled_csv_file) csv_string = selected_paper_info.to_csv(index=False) csv_filename = "selected_papers.csv" return selected_paper_info, {"csv_content": csv_string, "filename": csv_filename} # Create the interface iface = gr.Interface( fn=predict_and_download, inputs=["file", "file", "number", "textbox"], outputs=[gr.DataFrame(label="Selected Papers"), gr.DownloadButton(label="Download CSV")], title="Paper Prediction", description="Enter text and upload CSV files for labelled and unlabelled data.", allow_flagging='never' # Disable flagging feature ) iface.launch()