File size: 354 Bytes
160f7dd
 
 
 
 
 
 
 
 
 
 
 
 
0759d91
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()