shivansh-ka commited on
Commit
6db63c0
·
1 Parent(s): 19c338e

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +9 -4
app2.py CHANGED
@@ -28,22 +28,27 @@ def batch_predict(data):
28
  if prediction.data_validation(data):
29
  st.success(f'Data Validation Successfull :thumbsup:')
30
  preds = prediction.batch_predict(data)
 
31
  return preds.to_csv(index=False).encode('utf-8')
32
  else:
33
  st.error(f'Data Validation Failed :thumbsdown:')
34
 
35
  st.title('Toxic Comment Classifier')
36
- menu = ["Single Value Prediciton","Batch Prediction"]
37
- choice = st.sidebar.radio("Menu",menu)
38
 
39
- if choice=="Single Value Prediciton":
 
 
 
 
 
40
  st.subheader("Prediction")
41
  with st.form("comment_form"):
42
  comment = st.text_area(label="Enter your comment")
43
  button = st.form_submit_button(label="Submit")
44
  if button:
45
  single_predict(comment)
46
- else:
 
47
  st.subheader("Batch Prediction")
48
  csv_file = st.file_uploader("Upload File",type=['csv','parquet'])
49
 
 
28
  if prediction.data_validation(data):
29
  st.success(f'Data Validation Successfull :thumbsup:')
30
  preds = prediction.batch_predict(data)
31
+ print(type(preds))
32
  return preds.to_csv(index=False).encode('utf-8')
33
  else:
34
  st.error(f'Data Validation Failed :thumbsdown:')
35
 
36
  st.title('Toxic Comment Classifier')
 
 
37
 
38
+ tab1, tab2 = st.tabs(["Single Value Prediciton","Batch Prediction"])
39
+ #menu = ["Single Value Prediciton","Batch Prediction"]
40
+ #choice = st.sidebar.radio("Menu",menu)
41
+
42
+ #if choice=="Single Value Prediciton":
43
+ with tab1:
44
  st.subheader("Prediction")
45
  with st.form("comment_form"):
46
  comment = st.text_area(label="Enter your comment")
47
  button = st.form_submit_button(label="Submit")
48
  if button:
49
  single_predict(comment)
50
+ #else:
51
+ with tab2:
52
  st.subheader("Batch Prediction")
53
  csv_file = st.file_uploader("Upload File",type=['csv','parquet'])
54