File size: 778 Bytes
f14dbd1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()