from pycaret.regression import * import pandas as pd import numpy as np import gradio as gr model = load_model('produksi_fi_fix') def inferencing_model(ID_Afdeling, Luas, Tandan, HK, Jumlah_Pokok, Tahun_Tanam_Awal, Tahun_Tanam_Akhir, Curah_Hujan): pkk_ha = Jumlah_Pokok / Luas tandan_pkk = Tandan / Jumlah_Pokok umur = Tahun_Tanam_Akhir - Tahun_Tanam_Awal test_data = [[Tandan, umur, tandan_pkk, Curah_Hujan, Jumlah_Pokok, HK, pkk_ha]] pred = pd.DataFrame(test_data, columns=['tandan','umur', 'tandan_pkk', 'curah_hujan', 'jumlah_pokok', 'hk', 'pkk_ha']) prediction_test_produksi = predict_model(model, data = pred) return round(int(prediction_test_produksi.Label)) iface = gr.Interface( inferencing_model, [ gr.inputs.Dropdown(["SRO_I", "SRO_II", "SRO_III", "SRO_IV", "SRO_V", "SRO_VI", "SRO_VII", "SRO_VIII", "SRO_IX", "SRO_X"]), #Afdeling "number", #Luas "number", #Tandan "number", #HK "number", #Jumlah_Pokok "number", #Tahun_Tanam_Awal "number", #Tahun_Tanam_Akhir "number" #Curah_Hujan ], outputs= ["number"], #gr.outputs.Label(label="Produksi Prediction"), #"number", # interpretation="default", # Removed interpretation for dataframes examples=[ ["SRO_X", 920.50, 120166, 714, 142978, 1998, 2011, 216] ], allow_flagging=False, theme="huggingface", title="Produksi Prediction" ) iface.launch()