Spaces:
Runtime error
Runtime error
Commit
·
89465fa
1
Parent(s):
ae0b04d
Update app.py
Browse files
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 |
-
|
17 |
-
|
|
|
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()
|