Simrankodwani-2003's picture
Update app.py
71c6023 verified
Raw History Blame Contribute Delete
981 Bytes
# -*- coding: utf-8 -*-
"""Text_classifiers.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/12UdfdxBHN2JLxsSOPPzTp7JkXOXxArJn
"""
from transformers import pipeline
#!pip install transformers
classifier=pipeline("text-classification",model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")
classifier("I absolutely love this new phone! The camera quality is amazing")
classifier("this is so boring movie")
import gradio as gr
from transformers import pipeline
classifier=pipeline("text-classification",model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")
def predict_sentiments(text):
return classifier(text)[0]
gr.Interface(fn=predict_sentiments,
inputs=[gr.Textbox(label="Insert Prompt here", lines=5)],
outputs=[gr.Textbox(label="outputs sentiments", lines=3)],
title="My App"
).launch(share=True)
#!pip install gradio