| import gradio as gr |
| from predict_utils import load_model_and_thresholds, predict |
|
|
| model, tokenizer, thresholds = load_model_and_thresholds() |
|
|
| def classify_text(text): |
| return predict(text, model, tokenizer, thresholds) |
|
|
| gr.Interface( |
| fn=classify_text, |
| inputs=gr.Textbox(lines=4, placeholder="Masukkan teks untuk dideteksi..."), |
| outputs=gr.Label(num_top_classes=12, label="Prediksi Cyberbullying"), |
| title="๐ฌ IndoRoBERTa Cyberbullying Classifier ๐ฎ๐ฉ", |
| description="Model klasifikasi multi-label cyberbullying Bahasa Indonesia menggunakan IndoRoBERTa. Akurasi F1-macro 84%.", |
| examples=[ |
| ["Kamu jelek, bodoh dan gak berguna!"], |
| ["Kaum kalian harus dibasmi."], |
| ["Aduh anak-anak ini bikin kesel."] |
| ] |
| ).launch() |
|
|