Spaces:
Runtime error
Runtime error
Commit
·
73e3c19
1
Parent(s):
7d1ef5e
Upload Gradio app
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load model
|
5 |
+
classifier = pipeline("sentiment-analysis", model="Carsoleong/babi")
|
6 |
+
|
7 |
+
# Define inference function
|
8 |
+
def predict(text):
|
9 |
+
return classifier(text)
|
10 |
+
|
11 |
+
# Define Gradio interface
|
12 |
+
interface = gr.Interface(fn=predict, inputs="text", outputs="label", title="Sentiment Classifier")
|
13 |
+
|
14 |
+
interface.launch()
|