Spaces:
Sleeping
Sleeping
first
Browse files
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)
|