Esempio n. 1
0
def home():
    if request.method == 'POST':
        msg1 = request.form.get('Search')
        if msg1 == "":
            return render_template('index.html')
        msg, prob = pred.detecting_fake_news(msg1)
        res = {'message': msg, 'probability': prob}
        return render_template('result.html', data=res, msg=msg1)
    return render_template('index.html')
Esempio n. 2
0
def stringy():
    stringy = request.args.get('stringname')
    result = detecting_fake_news(stringy)
    print("LOOK HERE")

    print(result)
    convert = str(result)
    print(result)
    return (convert)
Esempio n. 3
0
def sms():
    resp = MessagingResponse()
    inbMsg = request.values.get('Body')
    pred, confidence = prediction.detecting_fake_news(inbMsg)

    resp.message(
        f'The news headline you entered is {pred[0]!r} and corresponds to {confidence[0][1]!r}.'
    )
    return str(resp)
Esempio n. 4
0
def predict():
    back = 'static/img/back.jpg'
    if request.method == 'POST':
        input_text = request.form.get('news')
        model = request.form.get('selectmodel')
        pred, prob = detecting_fake_news(input_text, model)
        return render_template('predict.html',
                               back=back,
                               pred=str(pred),
                               prob=str(prob))
    return render_template('predict.html',
                           back=back,
                           data=[{
                               'name': 'SVM'
                           }, {
                               'name': 'Logistic'
                           }, {
                               'name': 'SGD'
                           }, {
                               'name': 'Naive-bayes'
                           }, {
                               'name': 'RandomForest'
                           }])
Esempio n. 5
0
def stringy():
    stringy = request.args.get('stringname')
    detecting_fake_news(stringy)
    print(result)
    return jsonify(result)
Esempio n. 6
0
import PySimpleGUI as sg
import prediction

sg.theme('DarkAmber')  # Add a touch of color
# All the stuff inside your window.
layout = [[sg.Text('Enter the news you want to check : '),
           sg.InputText()], [sg.Button('Enter')],
          [sg.Text('Fake Image Detection'),
           sg.InputText()], [sg.FileBrowse('Upload Image')],
          [sg.Button('Cancel')]]

# Create the Window
window = sg.Window('Fake news/image Detection').Layout(layout)
# Event Loop to process "events" and get the "values" of the inputs
while True:
    event, values = window.read()

    if event in (True, 'Enter'):
        print('You entered ', values[0])
        truth, prob = prediction.detecting_fake_news(values[0])
        sg.Popup("The given statement is ", truth,
                 "The truth probability score is ", prob)
    if event in (True, 'Upload Image'):
        print('Image entered ', values[1])
    if event in (None, 'Cancel'):  # if user closes window or clicks cancel
        break
sg.Popup(event, values)
window.close()
Esempio n. 7
0
def stringy():
    stringy = request.args.get('stringname')
    boolean = detecting_fake_news(stringy)
    result = str(boolean)
    return jsonify(result)