Spaces:
Sleeping
Sleeping
| # -*- coding: utf-8 -*- | |
| """app.ipynb | |
| Automatically generated by Colab. | |
| Original file is located at | |
| https://colab.research.google.com/drive/1e-4W1GhMoAhnkr5q4ff2RPdxeuEDF-0s | |
| """ | |
| import gradio as gr | |
| import joblib | |
| # Load model dan vectorizer | |
| model = joblib.load("model_maxent.pkl") | |
| vectorizer = joblib.load("vectorizer.pkl") | |
| def predict_sentiment(text): | |
| X = vectorizer.transform([text]) | |
| result = model.predict(X)[0] | |
| return f"Sentimen: {result}" | |
| interface = gr.Interface( | |
| fn=predict_sentiment, | |
| inputs=gr.Textbox(lines=3, placeholder="Masukkan ulasan..."), | |
| outputs="text", | |
| title="Analisis Sentimen Ulasan Wisata", | |
| description="Model Maximum Entropy untuk klasifikasi sentimen dari ulasan pengunjung wisata." | |
| ) | |
| interface.launch() |