Sambhavnoobcoder's picture
updated and restructured app.py
1f2ab71
raw
history blame
486 Bytes
from tensorflow.keras.models import load_model
import numpy as np
import cv2
model = load_model('sentimentality.h5')
def sentiment(text):
result = model(text)[0]
label = result['label']
score = round(result['score'], 3)
return f"{label} ({score})"
input_text = gr.inputs.Textbox(label="Enter text here to be classified:")
label = gr.outputs.Label(num_top_classes=2)
gr.Interface(fn=predict_from_img, inputs=image, outputs=label,title = 'Sentiment-Analysis').launch()