SeyedAli commited on
Commit
c4cc2f7
1 Parent(s): d18c844

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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
- output=pipline(text)
11
- return output
 
 
 
 
12
 
13
- iface = gr.Interface(fn=Sentiment, inputs="text", outputs="text")
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)