Spaces:
Sleeping
Sleeping
File size: 639 Bytes
7ea3227 ac47b14 7ea3227 ac47b14 7ea3227 ac47b14 e7e7088 ac47b14 e7e7088 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
from transformers import pipeline
clf = pipeline("text-classification", model="afridi15/customer-support-intents")
def predict(text):
result = clf(text)[0] # {'label': 'LABEL_3', 'score': 0.85}
return {
"label": result["label"],
"score": float(result["score"])
}
with gr.Blocks() as demo:
gr.Markdown("# Intent Classifier API")
input_box = gr.Textbox(label="Message")
output_box = gr.JSON(label="Prediction")
input_box.submit(predict, inputs=input_box, outputs=output_box)
demo.queue(False) # 🚀 Disable queue mode → NO event_id, instant JSON
demo.launch()
|