Mummia-99 commited on
Commit
cc414db
·
verified ·
1 Parent(s): 64736a0

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +54 -0
  2. chat_review_model.joblib +3 -0
  3. tfidf_model.joblib +3 -0
app.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import numpy as np
3
+ import re
4
+ import streamlit as st
5
+ import joblib
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+
10
+ html_temp = """
11
+ <div style="background-color:black;padding:10px">
12
+ <h2 style="color:white;text-align:center;">Chat GPT Review Prediction </h2>
13
+ </div>
14
+ """
15
+ st.markdown(html_temp, unsafe_allow_html=True)
16
+
17
+ image_url="https://storage.googleapis.com/kaggle-datasets-images/6377125/10302664/91e3eb67027ab3122886b971613e7c2f/dataset-cover.jpg?t=2024-12-26-10-34-17"
18
+
19
+ st.image(image_url, use_column_width=True)
20
+
21
+
22
+
23
+ input_txt=st.text_input("Enter the Review")
24
+
25
+
26
+ # preprocess the text
27
+
28
+ def preprocess_text(text):
29
+ text = text.lower()
30
+ text = re.sub(r'\d+', '', text)
31
+ text = re.sub(r'[^\w\s]', '', text)
32
+ text = re.sub(r'\s+', ' ', text)
33
+
34
+ return text
35
+
36
+ # loading the models
37
+ loaded_tfidf = joblib.load("tfidf_model.joblib")
38
+ model = joblib.load("chat_review_model.joblib")
39
+
40
+ # processing
41
+ if input:
42
+ test=preprocess_text(input_txt)
43
+ label=loaded_tfidf.transform([test])
44
+
45
+ # predict and display
46
+ if st.button("Submit"):
47
+ predict=model.predict(label)[0]
48
+
49
+ if predict==1:
50
+ st.write("Its is a Good Review")
51
+
52
+ elif predict==0:
53
+ st.write("Its is a Bad Review")
54
+
chat_review_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43920f392997bec00f0921aaf501ef5f6b8348265b21f5b49377d7186d8c703d
3
+ size 243946
tfidf_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:900bf57884c008f008ef9a92d840eb275459c9a6110acb321a4b4b15c1829e56
3
+ size 1055889