HMPhuoc commited on
Commit
3333658
1 Parent(s): d2d2aca
Files changed (2) hide show
  1. main.py +2 -0
  2. train/add_data.py +7 -0
main.py CHANGED
@@ -1,5 +1,6 @@
1
  from flask import Flask, request
2
  from app import judge
 
3
  from flask_cors import CORS
4
 
5
  app = Flask(__name__)
@@ -21,4 +22,5 @@ def returnText(text):
21
  def check():
22
  comment = request.json['comment']
23
  result = judge(comment)
 
24
  return result
 
1
  from flask import Flask, request
2
  from app import judge
3
+ from train.add_data import add
4
  from flask_cors import CORS
5
 
6
  app = Flask(__name__)
 
22
  def check():
23
  comment = request.json['comment']
24
  result = judge(comment)
25
+ add(comment, result[0], result[1], result[2], result[3], result[4], result[5])
26
  return result
train/add_data.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+
3
+ def add(comment, toxic,s_toxic, obscene, threat, insult, identity_hate):
4
+ df = pd.read_csv('train.csv')
5
+ size = len(df.index)
6
+ df.loc[size] = [size,comment,toxic,s_toxic,obscene,threat,insult,identity_hate]
7
+ df.to_csv('train.csv')