Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def greet(image):
|
4 |
-
print(image)
|
5 |
-
return "something"
|
6 |
|
7 |
-
demo = gr.Interface(fn=greet, inputs="image", outputs="text")
|
8 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
def classify(text):
|
5 |
+
classifier = pipeline("zero-shot-classification")
|
6 |
+
candidate_labels = ["positive", "negative", "neutral"]
|
7 |
+
output = classifier(text, candidate_labels)
|
8 |
+
return output
|
9 |
+
|
10 |
+
|
11 |
+
demo = gr.Interface(fn=classify,
|
12 |
+
inputs=gr.Textbox(label="Enter text to classify"),
|
13 |
+
outputs=gr.Label(num_top_classes=3))
|
14 |
+
|
15 |
+
|
16 |
+
demo.launch()
|
17 |
|
|
|
|
|
|
|
18 |
|
|
|
|