sparrow8i8's picture
fixed up categories
aa71662
raw
history blame
554 Bytes
import gradio as gr
import fastai
import skimage
from fastai.vision.all import *
learn=load_learner('model.pkl')
categories=('negative','positive')
def classify(img):
pred,idx,probs=learn.predict(img)
return dict(zip(categories, map(float,probs)))
title = "Text sentiment classifier"
description = "This model classifies a sentence of text as having a positive or negative setiment"
text = gr.TextBox()
label= gr.Label()
intf=gr.Interface(fn=classify,inputs=text,outputs=label,title=title, description=description)
intf.launch(inline=False)