Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,12 @@ tokenizer = AutoTokenizer.from_pretrained('SeyedAli/Persian-Text-Sentiment-Bert-
|
|
7 |
|
8 |
def Sentiment(text):
|
9 |
pipline = pipeline(task="text-classification", model=model, tokenizer=tokenizer)
|
10 |
-
|
11 |
-
return output
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
iface = gr.Interface(fn=Sentiment, inputs="text", outputs=
|
14 |
iface.launch(share=False)
|
|
|
7 |
|
8 |
def Sentiment(text):
|
9 |
pipline = pipeline(task="text-classification", model=model, tokenizer=tokenizer)
|
10 |
+
preds=pipline(text)
|
11 |
+
# return output
|
12 |
+
outputs = {}
|
13 |
+
for p in preds:
|
14 |
+
outputs[p["label"]] = p["score"]
|
15 |
+
return outputs
|
16 |
|
17 |
+
iface = gr.Interface(fn=Sentiment, inputs="text", outputs=gr.outputs.Label())
|
18 |
iface.launch(share=False)
|