Spaces:
Runtime error
Runtime error
Commit
·
6d53da0
1
Parent(s):
431582d
Update app.py
Browse files
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
|
17 |
|
18 |
iface = gr.Interface(
|
19 |
fn=predict,
|
20 |
-
inputs=
|
21 |
-
outputs=
|
22 |
-
examples=[
|
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()
|