Prafuld3 commited on
Commit
ea55b65
1 Parent(s): 6971ed2

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +25 -0
  2. random_forest_model.joblib +3 -0
  3. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from sklearn.ensemble import RandomForestClassifier
4
+ from joblib import load
5
+
6
+ st.title("Tabular Data Sentiment Analysis")
7
+
8
+ model = load('random_forest_model.joblib')
9
+
10
+ df = pd.DataFrame(
11
+ [{'product_id': 30,
12
+ 'Review_Length': 252,
13
+ 'Rating': 4,
14
+ 'Avg_Word_Length': 5,
15
+ 'Times_purchased': 13,
16
+ 'unique_words': 40}])
17
+
18
+ edited_df = st.data_editor(df, num_rows="dynamic")
19
+
20
+ if st.button("Predict Sentiment", type="primary"):
21
+ output = model.predict(edited_df)
22
+ edited_df['predicted sentiment'] = output
23
+ edited_df['predicted sentiment'].replace({0:"Positive", 1:"Negative"}, inplace=True)
24
+ st.text(edited_df)
25
+
random_forest_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e35b91803dba1eeaa4bce6debda9f91457b09c7a45e8daee4d2ff9f086925dbe
3
+ size 5876137
requirements.txt ADDED
File without changes