File size: 624 Bytes
d827478
 
 
 
 
 
 
 
 
 
 
 
1c02cd3
d827478
 
 
249ccc6
 
d827478
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

pipeline = pipeline("text-classification", model="nickprock/distilbert-base-uncased-banking77-classification")

def predict(text):
  predictions = pipeline(text)
  return {p["label"]: p["score"] for p in predictions}
  
  gr.Interface(
    predict,
    inputs="textbox",
    outputs=gr.outputs.Label(num_top_classes=1),
    theme="huggingface", 
    title="Banking Intent Classifier",
    description="Try to classify customer queries",
    examples=[["I can't pay by my credit card"],["The amount on the transfer is wrong can I cancel it?"]],
    share=True
).launch()