nickprock commited on
Commit
d827478
·
1 Parent(s): 2ff126b

create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline("text-classification", model="nickprock/distilbert-base-uncased-banking77-classification")
5
+
6
+ def predict(text):
7
+ predictions = pipeline(text)
8
+ return {p["label"]: p["score"] for p in predictions}
9
+
10
+ gr.Interface(
11
+ predict,
12
+ inputs="textbox",
13
+ outputs="label",
14
+ theme="huggingface",
15
+ title="Banking Intent Classifier",
16
+ description="Try to classify customer queries",
17
+ examples=[["I can't pay by my credit card"],["The amount on the transfer is wrong can I cancel it?"]]
18
+ ).launch()