| import gradio as gr | |
| from transformers import pipeline | |
| reader = pipeline("text-classification", model='Guihss/TypeBERT', trust_remote_code=True, | |
| revision='main') | |
| def predict(text): | |
| return {s['label']: s['score'] for s in reader(text, top_k=None)} | |
| iface = gr.Interface(fn=predict, inputs="text", outputs='label') | |
| iface.launch() | |