manika07 commited on
Commit
15d0a5e
Β·
1 Parent(s): b55ed45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -45,20 +45,19 @@ tab1, tab2, tab3 = st.tabs(["πŸ“ˆ Load Data", "πŸ“ƒ Tagged ETDs", "πŸ““ Download
45
 
46
  with tab1:
47
  #===load data===
48
-
49
  if uploaded_file is not None:
50
- df = pd.read_csv(uploaded_file, encoding='latin-1')
51
- st.dataframe(df)
52
 
53
  with tab2:
54
  #===tagged ETDs===
55
  # Tag the "Abstract" column with the corresponding categories
56
 
57
  if uploaded_file is not None:
58
- df = pd.read_csv(uploaded_file, encoding='latin-1')
59
- st.dataframe(df)
60
- df['category'] = df['Abstract'].apply(predict_category)
61
- st.dataframe(df)
62
 
63
  # Function to predict the category for a given abstract
64
  def predict_category(abstract):
@@ -73,7 +72,7 @@ with tab3:
73
  # Create a download button
74
 
75
  if st.sidebar.button("Download"):
76
- csv = df.to_csv(index=False)
77
- b64 = base64.b64encode(csv.encode()).decode()
78
- href = f'<a href="data:file/csv;base64,{b64}" download="results.csv">Download csv file</a>'
79
- st.markdown(href, unsafe_allow_html=True)
 
45
 
46
  with tab1:
47
  #===load data===
 
48
  if uploaded_file is not None:
49
+ df = pd.read_csv(uploaded_file, encoding='latin-1')
50
+ st.dataframe(df)
51
 
52
  with tab2:
53
  #===tagged ETDs===
54
  # Tag the "Abstract" column with the corresponding categories
55
 
56
  if uploaded_file is not None:
57
+ df = pd.read_csv(uploaded_file, encoding='latin-1')
58
+ st.dataframe(df)
59
+ df['category'] = df['Abstract'].apply(predict_category)
60
+ st.dataframe(df)
61
 
62
  # Function to predict the category for a given abstract
63
  def predict_category(abstract):
 
72
  # Create a download button
73
 
74
  if st.sidebar.button("Download"):
75
+ csv = df.to_csv(index=False)
76
+ b64 = base64.b64encode(csv.encode()).decode()
77
+ href = f'<a href="data:file/csv;base64,{b64}" download="results.csv">Download csv file</a>'
78
+ st.markdown(href, unsafe_allow_html=True)