p1atdev's picture
Update app.py
a355e79 verified
raw
history blame contribute delete
348 Bytes
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()