File size: 359 Bytes
73e3c19
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
from transformers import pipeline

# Load model
classifier = pipeline("sentiment-analysis", model="Carsoleong/babi")

# Define inference function
def predict(text):
    return classifier(text)

# Define Gradio interface
interface = gr.Interface(fn=predict, inputs="text", outputs="label", title="Sentiment Classifier")

interface.launch()