wissemkarous's picture
update
81f670d verified
raw
history blame contribute delete
554 Bytes
# Use a pipeline as a high-level helper
from transformers import pipeline, Conversation
import gradio as gr
pipe = pipeline("text-classification", model="Junr-syl/sentiments_analysis_DISTILBERT")
def my_function(text):
out = pipe(text)
out = out[0]["label"] # cleaning the output
return out
with gr.Blocks() as demo :
input_componenet = gr.Text("i love AI",label="input")
output_componenet = gr.Text(label="output")
submit = gr.Button("submit")
submit.click(my_function,inputs=[input_componenet],outputs=[output_componenet])
demo.launch()