Spaces:
Runtime error
Runtime error
Update app.txt
Browse files
app.txt
CHANGED
|
@@ -1 +1,15 @@
|
|
| 1 |
-
SeyedAli/Persian-Text-Sentiment-Bert-V1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SeyedAli/Persian-Text-Sentiment-Bert-V1
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import torch
|
| 4 |
+
from transformers import AutoModelForSequenceClassification,AutoTokenizer,pipeline
|
| 5 |
+
|
| 6 |
+
model = AutoModelForSequenceClassification.from_pretrained('SeyedAli/Persian-Text-Sentiment-Bert-V1')
|
| 7 |
+
tokenizer = AutoTokenizer.from_pretrained('SeyedAli/Persian-Text-Sentiment-Bert-V1')
|
| 8 |
+
|
| 9 |
+
def Sentiment(text):
|
| 10 |
+
pipline = pipeline(task="text-classification", model=model, tokenizer=tokenizer)
|
| 11 |
+
output=pipline(text)
|
| 12 |
+
return output
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(fn=Sentiment, inputs="text", outputs="text")
|
| 15 |
+
iface.launch(share=False)
|