File size: 1,792 Bytes
2a5d1f7 244bc49 2a5d1f7 46d835c 2a5d1f7 244bc49 2a5d1f7 3f51766 2a5d1f7 3f51766 2a5d1f7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
import streamlit as st
import pandas as pd
import CosineDistanceClustering
import PU
import bert_embeddings
import oneclass
# Function to recommend papers
def recommend_papers(positive_df, unlabelled_df, model="tfidf"):
pass
# Streamlit app
def main():
st.title("ArXiv Feed Recommendations")
# User input for model selection
model = st.selectbox("Select Model", ["CosineDistanceClustering", "PU","oneclass"])
# Upload CSV files
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:
# Read CSV files
positive_df = pd.read_csv(positive_file)
unlabelled_df = pd.read_csv(unlabelled_file)
# Show uploaded data
st.subheader("Positive Labeled Data")
st.write(positive_df)
st.subheader("Unlabelled Data")
st.write(unlabelled_df)
# Button to trigger recommendation
if st.button("Recommend"):
# Call recommend_papers function
recommended_indices = recommend_papers(positive_df, unlabelled_df, model.lower())
st.write(recommended_indices)
# Download CSV
st.markdown(get_csv_download_link(recommended_indices), unsafe_allow_html=True)
# Function to generate a download link for CSV
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()
|