Spaces:
Build error
Build error
Commit ·
6b307bf
1
Parent(s): e62eed9
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -16,14 +16,11 @@ prediction = model_obj()
|
|
| 16 |
|
| 17 |
def single_predict(text):
|
| 18 |
preds = prediction.single_predict(text)
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
st.error(f'Toxic Comment!!! :thumbsdown:')
|
| 25 |
-
with col2:
|
| 26 |
-
prediction.plot(preds)
|
| 27 |
|
| 28 |
def batch_predict(data):
|
| 29 |
preds = prediction.batch_predict(data)
|
|
@@ -32,10 +29,7 @@ def batch_predict(data):
|
|
| 32 |
st.title('Toxic Comment Classifier')
|
| 33 |
st.write("This application will help to classify any comment or text in any language into 'TOXIC' or 'NON-TOXIC'")
|
| 34 |
tab1, tab2 = st.tabs(["Single Value Prediciton","Batch Prediction"])
|
| 35 |
-
#menu = ["Single Value Prediciton","Batch Prediction"]
|
| 36 |
-
#choice = st.sidebar.radio("Menu",menu)
|
| 37 |
|
| 38 |
-
#if choice=="Single Value Prediciton":
|
| 39 |
with tab1:
|
| 40 |
st.subheader("Prediction")
|
| 41 |
with st.form("comment_form", clear_on_submit=True):
|
|
@@ -43,7 +37,7 @@ with tab1:
|
|
| 43 |
button = st.form_submit_button(label="Submit")
|
| 44 |
if button:
|
| 45 |
single_predict(comment)
|
| 46 |
-
|
| 47 |
with tab2:
|
| 48 |
st.subheader("Batch Prediction")
|
| 49 |
csv_file = st.file_uploader("Upload File",type=['csv'])
|
|
|
|
| 16 |
|
| 17 |
def single_predict(text):
|
| 18 |
preds = prediction.single_predict(text)
|
| 19 |
+
if preds < 0.5:
|
| 20 |
+
st.success(f'Non Toxic Comment!!! :thumbsup:')
|
| 21 |
+
else:
|
| 22 |
+
st.error(f'Toxic Comment!!! :thumbsdown:')
|
| 23 |
+
prediction.plot(preds)
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
def batch_predict(data):
|
| 26 |
preds = prediction.batch_predict(data)
|
|
|
|
| 29 |
st.title('Toxic Comment Classifier')
|
| 30 |
st.write("This application will help to classify any comment or text in any language into 'TOXIC' or 'NON-TOXIC'")
|
| 31 |
tab1, tab2 = st.tabs(["Single Value Prediciton","Batch Prediction"])
|
|
|
|
|
|
|
| 32 |
|
|
|
|
| 33 |
with tab1:
|
| 34 |
st.subheader("Prediction")
|
| 35 |
with st.form("comment_form", clear_on_submit=True):
|
|
|
|
| 37 |
button = st.form_submit_button(label="Submit")
|
| 38 |
if button:
|
| 39 |
single_predict(comment)
|
| 40 |
+
|
| 41 |
with tab2:
|
| 42 |
st.subheader("Batch Prediction")
|
| 43 |
csv_file = st.file_uploader("Upload File",type=['csv'])
|