Spaces:
Running
Running
Using gradio.JSON()
Browse files... instead of "json" as return type, and returning list instead of dict. testing if this uses json.dumps instead of repr
app.py
CHANGED
@@ -23,7 +23,7 @@ def clf_text(txt: str):
|
|
23 |
# d = dict(zip(res["labels"], res["scores"]))
|
24 |
# output = [f"{lbl}:\t{score}" for lbl, score in items]
|
25 |
# return "\n".join(output)
|
26 |
-
return
|
27 |
# classifier(sequence_to_classify, candidate_labels)
|
28 |
#{'labels': ['travel', 'dancing', 'cooking'],
|
29 |
# 'scores': [0.9938651323318481, 0.0032737774308770895, 0.002861034357920289],
|
@@ -37,6 +37,6 @@ gradio_interface = gradio.Interface(
|
|
37 |
# fn = my_inference_function,
|
38 |
fn = clf_text,
|
39 |
inputs = "text",
|
40 |
-
outputs =
|
41 |
)
|
42 |
gradio_interface.launch()
|
|
|
23 |
# d = dict(zip(res["labels"], res["scores"]))
|
24 |
# output = [f"{lbl}:\t{score}" for lbl, score in items]
|
25 |
# return "\n".join(output)
|
26 |
+
return list(items)
|
27 |
# classifier(sequence_to_classify, candidate_labels)
|
28 |
#{'labels': ['travel', 'dancing', 'cooking'],
|
29 |
# 'scores': [0.9938651323318481, 0.0032737774308770895, 0.002861034357920289],
|
|
|
37 |
# fn = my_inference_function,
|
38 |
fn = clf_text,
|
39 |
inputs = "text",
|
40 |
+
outputs = gradio.JSON()
|
41 |
)
|
42 |
gradio_interface.launch()
|