|
import oneclass |
|
import gradio as gr |
|
import pandas as pd |
|
from io import StringIO |
|
|
|
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_buffer = StringIO() |
|
|
|
|
|
selected_paper_info.to_csv(csv_buffer, index=False) |
|
|
|
|
|
csv_content = csv_buffer.getvalue() |
|
|
|
|
|
|
|
|
|
|
|
return selected_paper_info, csv_content |
|
|
|
|
|
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' |
|
) |
|
|
|
iface.launch() |