File size: 955 Bytes
a5a950d
a97d061
a5a950d
 
 
 
 
 
 
 
 
 
 
 
 
29c72d8
a5a950d
 
 
29c72d8
a5a950d
 
 
 
 
 
 
 
 
 
1bf4891
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
import tensorflow 
from tensorflow.keras.models import load_model
import prepro
import numpy as np
import nltk


def classify(text):
    nltk.download('stopwords')
    model= load_model('nlp3.h5')
    X= prepro.preprocess(text)
    prediction = model.predict(np.array(X))
    # return prediction
    if(prediction<=0.4):
        return "Looks like you are reading negative content. Some words sound negative in context."
    elif(prediction>0.4 and prediction<=0.6):
        return "Sounds Neutral. Speaks generally and not biased towards any value."
    else :       
        return "Sounds Positive. Giving a good impression to start reading this stuff. "


iface= gr.Interface(
    inputs=[gr.inputs.Textbox(lines=5, label="Context", placeholder="Type a sentence or paragraph here.")],
    outputs=[gr.outputs.Textbox(label="Prediction")],
    fn=classify, 
    title='WATCHA-READIN',
    theme='dark-peach'       
)

iface.launch()