sergeyfeldman commited on
Commit
89465fa
·
1 Parent(s): ae0b04d

Update app.py

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