nrotem commited on
Commit
ab54e3b
·
1 Parent(s): f85eaf4
Files changed (1) hide show
  1. main.py +18 -0
main.py CHANGED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification ,pipeline
2
+
3
+ tokenizer = AutoTokenizer.from_pretrained("avichr/heBERT_sentiment_analysis")
4
+
5
+ model = AutoModelForSequenceClassification.from_pretrained("avichr/heBERT_sentiment_analysis")
6
+
7
+ sentiment_analysis = pipeline(
8
+ "sentiment-analysis",
9
+ model="avichr/heBERT_sentiment_analysis",
10
+ tokenizer="avichr/heBERT_sentiment_analysis",
11
+ return_all_scores = True
12
+ )
13
+
14
+ import gradio as gr
15
+ def sme(text):
16
+ return sentiment_analysis(text)
17
+ demo = gr.Interface(fn=sme, inputs="text", outputs="json")
18
+ demo.launch(share=True)