Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pip install gradio
|
2 |
+
pip install torch
|
3 |
+
pip install transformers --upgrade
|
4 |
+
|
5 |
+
import gradio as gr
|
6 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
7 |
+
|
8 |
+
ckpt = 'mrm8488/distilroberta-finetuned-banking77'
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained(ckpt)
|
10 |
+
model = AutoModelForSequenceClassification.from_pretrained(ckpt)
|
11 |
+
|
12 |
+
classifier = pipeline('text-classification', tokenizer=tokenizer, model=model)
|
13 |
+
|
14 |
+
demo= gr.Interface.from_pipeline(classifier)
|
15 |
+
demo.launch()
|