File size: 599 Bytes
8805952
 
 
3df15be
8805952
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

MODEL_ID = "gau2345/autotrain-bk2rf-3sf1s"  # your fine-tuned model repo
clf = pipeline("text-classification", model=MODEL_ID)

def predict(text):
    out = clf(text, truncation=True)
    # Return as label→score dict for a nice probability bar
    return {r["label"]: float(r["score"]) for r in out}

gr.Interface(
    fn=predict,
    inputs=gr.Textbox(lines=3, label="Customer message"),
    outputs=gr.Label(num_top_classes=5),
    title="Amazon Intent Classifier",
    description="Paste a customer message to classify intent."
).launch()