sergeyfeldman commited on
Commit
6d53da0
·
1 Parent(s): 431582d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -13,13 +13,13 @@ all_label_names = list(model.config.id2label.values())
13
 
14
  def predict(text):
15
  probs = expit(model(**tokenizer([texts], return_tensors="pt", padding=True)).logits.detach().numpy())
16
- return list(zip(all_label_names, probs[0]))
17
 
18
  iface = gr.Interface(
19
  fn=predict,
20
- inputs='What is going on with you',
21
- outputs='Our predictions',
22
- examples=[["This test tomorrow is really freaking me out."]]
23
  )
24
 
25
  iface.launch()
 
13
 
14
  def predict(text):
15
  probs = expit(model(**tokenizer([texts], return_tensors="pt", padding=True)).logits.detach().numpy())
16
+ return {i: np.round(j, 2) for i, j in zip(all_label_names, probs[0])}
17
 
18
  iface = gr.Interface(
19
  fn=predict,
20
+ inputs="text",
21
+ outputs="label",
22
+ examples=["This test tomorrow is really freaking me out."]
23
  )
24
 
25
  iface.launch()