Spaces:
Runtime error
Runtime error
Initial commit.
Browse files- .gitignore +1 -0
- app.py +15 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.idea
|
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-large-zeroshot-v1")
|
7 |
+
|
8 |
+
|
9 |
+
def classify(review, candidate_labels=('positive', 'neutral', 'negative')):
|
10 |
+
labels = classifier(review, candidate_labels)
|
11 |
+
return gradio.Label(label='Classification', value=(dict(zip(labels['labels'], labels['scores']))))
|
12 |
+
|
13 |
+
|
14 |
+
app = gr.Interface(fn=classify, inputs=['text'], outputs=['label'], allow_flagging="never")
|
15 |
+
app.launch()
|