Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import torch
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
@@ -18,7 +19,7 @@ classifier = pipeline(
|
|
18 |
|
19 |
def predict(user_input: str):
|
20 |
|
21 |
-
prediction = classifier(user_input)[0]
|
22 |
label = prediction['label']
|
23 |
probability = prediction['score']
|
24 |
|
|
|
1 |
import torch
|
2 |
+
import json
|
3 |
import gradio as gr
|
4 |
|
5 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
|
|
19 |
|
20 |
def predict(user_input: str):
|
21 |
|
22 |
+
prediction = json.loads(classifier(user_input))[0]
|
23 |
label = prediction['label']
|
24 |
probability = prediction['score']
|
25 |
|