Пример #1
0
def predictRoute():
    print('in plot')
    if request.method=='POST':
        print('if')
        try:
            image = request.json['sound']
            # print('image',image)
            print('image')
            decodeSound(image, "video.mp4")
            print('decodeSound')
            clip = mp.VideoFileClip("video.mp4")
            print('clip video')
            clip.audio.write_audiofile("audio123.wav")
            print('clip audio')
            result = speechToText.speech2Text("audio123.wav")
            print('result')
            summary=summ.summarize(result)
            print('sssssssummary',summary)
            result='<h4 style=color:#273582>ORIGINAL TEXT:</h4>'+result+'<br>'+'<h4 style=color:#273582>SUMMARIZED TEXT:</h4>'+summary
            return jsonify({"Result" : str(result)})
            # return render_template('results.html')
            # return render_template('results.html',result=result,summary=summary)

        except Exception as e:
            print('The Exception message is: ', e)
            return 'something is wrong'
Пример #2
0
def predictRoute():
    try:
        image = request.json['sound']
        decodeSound(image, "audio123.wav")
        result = predict()
        #print(result)
        #print(type(result))
        #return jsonify(result)

    except ValueError as val:
        print(val)
        return Response("Value not found inside  json data")
    except KeyError:
        return Response("Key value error incorrect key passed")
    except Exception as e:
        print(e)
        result = "Invalid input"

    return {"Result": result}
Пример #3
0
def predictRoute():
    image = request.json['sound']
    decodeSound(image, "inputSound.wav")
    result = predict()
    return jsonify({"Result": result})
Пример #4
0
def predictRoute():
    image = request.json['sound']
    decodeSound(image, "audio123.wav")
    result = speechToText.speech2Text("audio123.wav")
    return jsonify({"Result" : str(result)})