File size: 603 Bytes
473a71d
2772eb5
aa35a85
473a71d
 
aa35a85
 
 
 
 
2772eb5
aa35a85
 
 
 
 
 
 
 
 
 
473a71d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import joblib
import gradio as gr

model = joblib.load('sentiment_model.pkl')
vectorizer = joblib.load('count_vectorizer.pkl')

# Fungsi untuk melakukan prediksi sentimen
def predict_sentiment(comment):
    comment_vec = vectorizer.transform([comment])
    prediction = model.predict(comment_vec)[0]
    return prediction

# Tampilan antarmuka Gradio
iface = gr.Interface(
    fn=predict_sentiment,
    inputs="textbox",
    outputs="label",
    title="Instagram Comment Sentiment Analysis",
    description="Enter an Instagram comment to predict its sentiment (Positive or Negative)."
)

iface.launch()