| from tensorflow.keras.models import load_model | |
| import numpy as np | |
| import cv2 | |
| import gradio as gr | |
| 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=input_text, outputs=label,title = 'Sentiment-Analysis').launch() |