|
import streamlit as st |
|
import pandas as pd |
|
|
|
import PU |
|
import bert_embeddings |
|
import oneclass |
|
|
|
|
|
def recommend_papers(positive_df, unlabelled_df, model="tfidf"): |
|
pass |
|
|
|
|
|
def main(): |
|
st.title("ArXiv Feed Recommendations") |
|
|
|
|
|
model = st.selectbox("Select Model", ["CosineDistanceClustering", "PU","oneclass"]) |
|
|
|
|
|
st.subheader("Upload Positive Labeled CSV") |
|
positive_file = st.file_uploader("Upload CSV", type=['csv'], key="positive") |
|
st.subheader("Upload Unlabelled Data CSV") |
|
unlabelled_file = st.file_uploader("Upload CSV", type=['csv'], key="unlabelled") |
|
|
|
|
|
if positive_file is not None and unlabelled_file is not None: |
|
|
|
positive_df = pd.read_csv(positive_file) |
|
unlabelled_df = pd.read_csv(unlabelled_file) |
|
|
|
|
|
st.subheader("Positive Labeled Data") |
|
st.write(positive_df) |
|
st.subheader("Unlabelled Data") |
|
st.write(unlabelled_df) |
|
|
|
|
|
if st.button("Recommend"): |
|
|
|
recommended_indices = recommend_papers(positive_df, unlabelled_df, model.lower()) |
|
st.write(recommended_indices) |
|
|
|
|
|
st.markdown(get_csv_download_link(recommended_indices), unsafe_allow_html=True) |
|
|
|
|
|
def get_csv_download_link(data): |
|
csv = data.to_csv(index=False) |
|
b64 = base64.b64encode(csv.encode()).decode() |
|
href = f'<a href="data:file/csv;base64,{b64}" download="recommendations.csv">Download CSV</a>' |
|
return href |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|