Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
|
| 6 |
-
def
|
| 7 |
-
|
| 8 |
-
return
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
pipe = pipeline("text-classification", model="nickprock/distilbert-base-uncased-banking77-classification")
|
| 5 |
|
| 6 |
+
def greet(text):
|
| 7 |
+
response = pipe(text)
|
| 8 |
+
return response[0]['label']
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(fn=greet,
|
| 11 |
+
inputs="text",
|
| 12 |
+
outputs="text",
|
| 13 |
+
theme="huggingface",
|
| 14 |
+
title="Banking Intent Classifier",
|
| 15 |
+
description="Try to classify customer queries",
|
| 16 |
+
examples=[["I can't pay by my credit card"],["The amount on the transfer is wrong can I cancel it?"], "My card still hasn't been delivered "],
|
| 17 |
+
share=True)
|
| 18 |
+
|
| 19 |
+
demo.launch()
|