schroneko's picture
Update app.py
776def7 verified
raw
history blame
421 Bytes
import gradio as gr
from transformers import pipeline
def classify_text(text):
pipe = pipeline("text-classification", model="meta-llama/Prompt-Guard-86M")
result = pipe(text)[0]
return {result['label']: result['score']}
demo = gr.Interface(
fn=classify_text,
inputs="text",
outputs="label",
title="Prompt-Guard-86M Text Classification"
)
demo.launch(server_name="0.0.0.0", server_port=7860)