prettier output
Browse files
app.py
CHANGED
|
@@ -18,9 +18,13 @@ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
|
| 18 |
|
| 19 |
|
| 20 |
def classify(text):
|
| 21 |
-
return
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
iface = gr.Interface(fn=classify, inputs="text", outputs="text")
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
def classify(text):
|
| 21 |
+
return (
|
| 22 |
+
reverse_map[
|
| 23 |
+
model(**tokenizer(text, return_tensors="pt")).logits.argmax(-1).item()
|
| 24 |
+
]
|
| 25 |
+
.replace("_", " ")
|
| 26 |
+
.capitalize()
|
| 27 |
+
)
|
| 28 |
|
| 29 |
|
| 30 |
iface = gr.Interface(fn=classify, inputs="text", outputs="text")
|