manika07 commited on
Commit
6aa5902
·
1 Parent(s): c71e3a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -62,8 +62,8 @@ svm_classifier = read_model("https://github.com/manika-lamba/ml/raw/main/model-t
62
  preprocessing = read_tf("https://github.com/manika-lamba/ml/raw/main/tfidf-topics.pkl")
63
 
64
 
65
- # Function to predict the category for a given abstract
66
- def predict_category(abstract):
67
  # Preprocess the abstract
68
  abstract_preprocessed = preprocessing.transform([abstract])
69
  # Make prediction
@@ -93,8 +93,8 @@ if uploaded_file is not None:
93
  df = pd.read_csv(uploaded_file, encoding='latin-1')
94
  st.dataframe(df)
95
 
96
- # Tag the "Abstract" column with the corresponding categories
97
- df['category'] = df['Abstract'].apply(lambda x: predict_category(x)[0])
98
  st.dataframe(df)
99
 
100
  # Convert DataFrame to CSV and encode it properly
 
62
  preprocessing = read_tf("https://github.com/manika-lamba/ml/raw/main/tfidf-topics.pkl")
63
 
64
 
65
+ # Function to predict the topic for a given abstract
66
+ def predict_topic (abstract):
67
  # Preprocess the abstract
68
  abstract_preprocessed = preprocessing.transform([abstract])
69
  # Make prediction
 
93
  df = pd.read_csv(uploaded_file, encoding='latin-1')
94
  st.dataframe(df)
95
 
96
+ # Tag the "Abstract" column with the corresponding topics
97
+ df['topic'] = df['Abstract'].apply(lambda x: predict_topic(x)[0])
98
  st.dataframe(df)
99
 
100
  # Convert DataFrame to CSV and encode it properly