Ejemplo n.º 1
0
def emotion():
    task_id = request.args['task_id']
    if task_id is None:
        task_id = uuid.uuid4().hex
    url = request.args.get("url")
    if url is None:
        print("URL not provided")
        task_url = misc.get_task_url(task_id)
    else:
        task_url = url
    global loaded_model
    if loaded_model is None:
        loaded_model = emotion_api.getModel()
        loaded_model._make_predict_function()
    emotion_blocks = analysis_api.emotion(task_url, task_id, loaded_model)
    return jsonpickle.encode(emotion_blocks)
Ejemplo n.º 2
0
def transcibe_emotion():
    task_id = request.args['task_id']
    if task_id is None:
        task_id = uuid.uuid4().hex
    task_url = misc.get_task_url(task_id)
    url = request.args.get("url")
    if url is None:
        print("URL not provided")
    else:
        task_url = url
    language = request.args['language']
    model = (request.args['model'] == 'True')
    engine = request.args['engine']
    if engine is None:
        engine = 'google'
    conversation_blocks = analysis_api.transcribe_emotion(engine, task_id, language, model, loaded_model, pool, task_url)
    return jsonpickle.encode(conversation_blocks)
Ejemplo n.º 3
0
def downloadTaskAudio(taskId):
    downloadResult = misc.download_file(misc.get_task_url(taskId), TASK_PATH)
    return downloadResult