Spaces:
Build error
Build error
import gradio as gr | |
from transformers import pipeline | |
pipe = pipeline("text-classification", model="p1atdev/saikyou-shield-30m") | |
def classify(text): | |
return { | |
item["label"]: item["score"] | |
for item in pipe(text, top_k=2) | |
} | |
demo = gr.Interface( | |
fn=classify, | |
inputs=["text"], | |
outputs=["label"], | |
) | |
demo.launch() | |