Exemplo n.º 1
0
 def __init__(self):
     super().__init__()
     Emotions.loadEmotions()
     Bots.loadBots()
     self.__current__bot__ = Bots.getGeneral()
     self.__current__bot__index__ = 0
     Entries.loadEntries(self.__current__bot__)
Exemplo n.º 2
0
 def test_find_2(self):
     term = "giận"
     emotion = Emotions.find(term)
     self.assertEqual(emotion.name, "giận dữ")
     term = "cáu"
     emotion = Emotions.find(term)
     self.assertEqual(emotion.name, "giận dữ")
Exemplo n.º 3
0
 def test_level_2(self):
     term = "tin tưởng"
     response(term)
     emotion = Emotions.find(term)
     levels = ["tán thành", "ngưỡng mộ"]
     self.assertEqual(emotion.levels, levels)
     self.assertIsNotNone(emotion.levels)
Exemplo n.º 4
0
 def __init__(self, text="", type=AnswerTypes.NONE, emotions=None):
     self.type = type
     self.text = text
     if (emotions is not None):
         self.emotions = emotions
     else:
         self.emotions = [1 for x in range(Emotions.getLength())]
     self.data = self.to_dict()
Exemplo n.º 5
0
def response(term):
    term = term.strip().lower()
    item = Emotions.find(term)
    if item:
        item.display()
        print()
    else:
        print(f"Không tìm thấy \"{term}\"")
Exemplo n.º 6
0
from flask import Flask, render_template, Response, jsonify, request
from camera import VideoCamera
from camera import predict
from data import Emotions
import cv2
import numpy as np
from keras.models import model_from_json
from keras.preprocessing import image

app = Flask(__name__)

video_camera = VideoCamera()
global_frame = None

Emotions = Emotions()

# ===================FOR DEVELOPMENT ONLY=================
app.debug = True
# =========================================


@app.route('/whatemotion')
def emotion():
    return render_template('emotions.html', emotion=predict())


# VIDEO RECORDING


@app.route('/record_status', methods=['POST'])
def record_status():
Exemplo n.º 7
0
 def test_attr_1(self):
     term = "giận"
     emotion = Emotions.find(term)
     synonym_terms = {'cáu', 'hậm hực', 'tức giận', 'điên tiết', 'giận'}
     self.assertEqual(emotion.synonym, synonym_terms)
Exemplo n.º 8
0
 def test_find_1(self):
     term = "buồn"
     emotion = Emotions.find(term)
     self.assertEqual(emotion.name, term)
Exemplo n.º 9
0
 def test_level_1(self):
     term = "hậm hực"
     emotion = Emotions.find(term)
     print(emotion)
     levels = ['tức giận', 'điên tiết', 'hậm hực']
     self.assertEqual(emotion.levels, levels)