Koles_Score / app.py
DioLiu's picture
Create app.py
f14dbd1
raw
history blame contribute delete
778 Bytes
import transformers
from huggingface_hub import notebook_login
from datasets import load_dataset
from transformers import AutoModelForSequenceClassification
model = AutoModelForSequenceClassification.from_pretrained("DioLiu/autotrain-koles_score-3215890190")
from transformers import AutoTokenizer
model_checkpoint = "distilbert-base-uncased"
tokenizer = AutoTokenizer.from_pretrained("DioLiu/autotrain-koles_score-3215890190")
from transformers import pipeline
import gradio as gr
from transformers import pipeline
classifier = pipeline("sentiment-analysis",model=model,tokenizer=tokenizer)
def get_sentiment(input_text):
return classifier(input_text)
iface = gr.Interface(fn= get_sentiment, inputs="text", outputs = ["text"], title="Sentiment Analysis")
iface.launch()