File size: 597 Bytes
ab54e3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import AutoTokenizer, AutoModelForSequenceClassification ,pipeline

tokenizer = AutoTokenizer.from_pretrained("avichr/heBERT_sentiment_analysis")

model = AutoModelForSequenceClassification.from_pretrained("avichr/heBERT_sentiment_analysis")

sentiment_analysis = pipeline(
    "sentiment-analysis",
    model="avichr/heBERT_sentiment_analysis",
    tokenizer="avichr/heBERT_sentiment_analysis",
    return_all_scores = True
)

import gradio as gr
def sme(text):
  return sentiment_analysis(text)
demo = gr.Interface(fn=sme, inputs="text", outputs="json")
demo.launch(share=True)