Spaces:
Build error
Build error
| # 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() |