ebelfrank's picture
Update app.py
0c6f353 verified
raw
history blame contribute delete
647 Bytes
import gradio as gr
import xgboost as xgb
import numpy as np
# Load the XGBoost model
model = xgb.Booster()
model.load_model("xgboost_model.json")
# Define a prediction function
def predict(inputs):
dmatrix = xgb.DMatrix(np.array(inputs))
prediction = model.predict(dmatrix)
return prediction.tolist()
# Create the Gradio interface
input_features = gr.Dataframe(headers=["temperature", "humidity", "vibration_amplitude", "vibration_frequency", "sound_amplitude", "sound_frequency"])
output_label = gr.Textbox()
gr.Interface(fn=predict, inputs=input_features, outputs=output_label, title="Fiber Optic Intrusion Detection").launch()