예제 #1
0
 def post(self):
     f = request.files['file-name']
     basepath = os.path.dirname(__file__)
     file_path = os.path.join('uploads', secure_filename(f.filename))
     print(file_path)
     f.save(file_path)
     sents_in_summary = 5
     summary_string = extract(file_path)
     doc = nlp(summary_string)
     text = generate_summary(doc, sents_in_summary)
     print(text)
     headers = {'Content-Type': 'text/html'}
     try:
         if (request.form["param"] == "1"):
             return jsonify({
                 "data": {
                     "summary": text,
                 },
                 "from": "summarizer",
             })
     except:
         return make_response(
             render_template('summarizer.html',
                             text_data=text,
                             user_name=session['user_name'],
                             initials=session['initials'],
                             title="Summarize Text"), 200, headers)
예제 #2
0
 def post(self):
     f = request.files['file-name']
     basepath = os.path.dirname(__file__)
     file_path = os.path.join('uploads', secure_filename(f.filename))
     print(file_path)
     f.save(file_path)
     reg_dic = extract(file_path)
     senti_output = predict(reg_dic, True)
     print(senti_output)
     headers = {'Content-Type': 'text/html'}
     try:
         if (request.form["param"] == "1"):
             return jsonify({
                 "data": {
                     "sentiment_analysis": senti_output,
                 },
                 "from": "sentiment_analysis",
             })
     except:
         return make_response(
             render_template('sentimental.html',
                             text_data=senti_output,
                             user_name=session['user_name'],
                             initials=session['initials'],
                             title="Feedback Form"), 200, headers)
예제 #3
0
 def post(self):
     print(type(request))
     f = request.files['file-name']
     # print(request.form["param"])
     # print(type(request.form['param']))
     basepath = os.path.dirname(__file__)
     file_path = os.path.join('uploads', secure_filename(f.filename))
     print(file_path)
     f.save(file_path)
     resume_string = extract(file_path)
     dic = dict()
     nlp = spacy.load('en')
     dic = transform(dic, nlp, resume_string)
     for x in dic[0]:
         if type(dic[0][x]) == set:
             dic[0][x] = list(dic[0][x])
     # dic[0] is tuple of lists(which contains key-value pair)
     print('DATA CONTENT OF DIC[0]', dic[0])
     headers = {'Content-Type': 'text/html'}
     keys = []
     values = []
     count = 0
     with open('top_skills.csv', 'r') as csvfile:
         csvreader = csv.reader(csvfile)
         for row in csvreader:
             if count == 0:
                 keys = row
                 count = count + 1
             else:
                 values = row
     print('keys', keys)
     print('values', values)
     skills = []
     for i in range(len(keys)):
         skills.append([keys[i], values[i]])
     print('skills', skills)
     try:
         if (request.form["param"] is not None
                 and request.form["param"] == "1"):
             return jsonify({
                 "data": {
                     "resume_data": dic[0],
                     "top_skills": skills,
                 },
                 "from": "resume"
             })
     except:
         return make_response(
             render_template('resume.html',
                             text_data=dic[0],
                             skills=skills,
                             user_name=session['user_name'],
                             initials=session['initials'],
                             title="Resume"), 200, headers)
예제 #4
0
 def post(self):
     f = request.files['file-name']
     basepath = os.path.dirname(__file__)
     file_path = os.path.join('uploads', secure_filename(f.filename))
     print(file_path)
     f.save(file_path)
     reg_dic = extract(file_path)
     senti_output = predict(reg_dic, True)
     print(senti_output)
     headers = {'Content-Type': 'text/html'}
     return make_response(
         render_template('sentimental.html', text_data=senti_output), 200,
         headers)
예제 #5
0
    def post(self):
        f = request.files['file-name']
        basepath = os.path.dirname(__file__)
        file_path = os.path.join('uploads', secure_filename(f.filename))
        print(file_path)
        f.save(file_path)
        reg_dic = extract(file_path)

        if classify(reg_dic) == 1:
            senti_output = predict(reg_dic, True)
            print(senti_output)
            headers = {'Content-Type': 'text/html'}
            # return make_response(render_template('sentimental.html',text_data=senti_output),200,headers)
            return redirect(url_for('sentimental', text_data=senti_output),
                            code=307)
        elif classify(reg_dic) == 2:
            dic = dict()
            nlp = spacy.load('en')
            dic = transform(dic, nlp, reg_dic)
            for x in dic[0]:
                if type(dic[0][x]) == set:
                    dic[0][x] = list(dic[0][x])
            # dic[0] is tuple of lists(which contains key-value pair)
            print('DATA CONTENT OF DIC[0]', dic[0])
            headers = {'Content-Type': 'text/html'}
            keys = []
            values = []
            count = 0
            with open('top_skills.csv', 'r') as csvfile:
                csvreader = csv.reader(csvfile)
                for row in csvreader:
                    if count == 0:
                        keys = row
                        count = count + 1
                    else:
                        values = row
            print('keys', keys)
            print('values', values)
            skills = []
            for i in range(len(keys)):
                skills.append([keys[i], values[i]])
            print('skills', skills)
            # return make_response(render_template('resume.html',text_data=dic[0],skills=skills),200,headers)
            return redirect(url_for('resume', text_data=dic[0], skills=skills),
                            code=307)
        else:
            output = 3
            headers = {'Content-Type': 'text/html'}
            return make_response(
                render_template('classifier.html', text_data=output), 200,
                headers)
예제 #6
0
 def post(self):
     f = request.files['file-name']
     basepath = os.path.dirname(__file__)
     file_path = os.path.join('uploads', secure_filename(f.filename))
     print(file_path)
     f.save(file_path)
     sents_in_summary = 5
     summary_string = extract(file_path)
     doc = nlp(summary_string)
     text = generate_summary(doc, sents_in_summary)
     print(text)
     headers = {'Content-Type': 'text/html'}
     return make_response(
         render_template('summarizer.html', text_data=text), 200, headers)
예제 #7
0
    def post(self):
        f = request.files['file-name']
        basepath = os.path.dirname(__file__)
        file_path = os.path.join('uploads', secure_filename(f.filename))
        print(file_path)
        f.save(file_path)
        reg_dic = extract(file_path)

        if classify(reg_dic) == 1:
            senti_output = predict(reg_dic, True)
            print(senti_output)
            headers = {'Content-Type': 'text/html'}
            try:
                if (request.form["param"] == "1"):
                    return jsonify({
                        "data": {
                            "sentiment_analysis": senti_output,
                        },
                        "from": "sentiment_analysis",
                    })
            except:
                return redirect(url_for('sentimental',
                                        text_data=senti_output,
                                        user_name=session['user_name'],
                                        initials=session['initials'],
                                        title="Feedback Form"),
                                code=307)
        elif classify(reg_dic) == 2:
            dic = dict()
            nlp = spacy.load('en')
            dic = transform(dic, nlp, reg_dic)
            for x in dic[0]:
                if type(dic[0][x]) == set:
                    dic[0][x] = list(dic[0][x])
            print('DATA CONTENT OF DIC[0]', dic[0])
            headers = {'Content-Type': 'text/html'}
            keys = []
            values = []
            count = 0
            with open('top_skills.csv', 'r') as csvfile:
                csvreader = csv.reader(csvfile)
                for row in csvreader:
                    if count == 0:
                        keys = row
                        count = count + 1
                    else:
                        values = row
            print('keys', keys)
            print('values', values)
            skills = []
            for i in range(len(keys)):
                skills.append([keys[i], values[i]])
            print('skills', skills)
            try:
                if (request.form["param"] == "1"):
                    return jsonify({
                        "data": {
                            "resume_data": dic[0],
                            "top_skills": skills,
                        },
                        "from": "resume"
                    })
            except:
                return redirect(url_for('resume',
                                        text_data=dic[0],
                                        skills=skills,
                                        user_name=session['user_name'],
                                        initials=session['initials'],
                                        title="Resume"),
                                code=307)
        else:
            output = 3
            headers = {'Content-Type': 'text/html'}
            try:
                if request.form["param"] == "1":
                    return jsonify({
                        "data": {
                            "classifier_data": output
                        },
                        "from": "classifier"
                    })
            except:
                return make_response(
                    render_template('classifier.html',
                                    text_data=output,
                                    user_name=session['user_name'],
                                    initials=session['initials'],
                                    title="Classify Form"), 200, headers)