XaCC / app.py
DocSrvNyk's picture
Update app.py
5a95511 verified
import gradio as gr
from joblib import load
import numpy as np
# Load the trained model
model = load("ML_Model_CallCorr.joblib")
def predict_corrected_calcium(total_calcium, total_protein, albumin):
# Calculate Albumin to Total Protein Ratio
atr = albumin / total_protein
# Predict the actual calcium value using the model
predicted_value = model.predict([[total_calcium, atr]])[0]
# Return the result string
return f"{predicted_value:.2f}.\n\nThe model has a MSE of 0.06, MAD of 0.08 and R-squared of 0.931."
# Define the Gradio interface
interface = gr.Interface(fn=predict_corrected_calcium,
inputs=[gr.inputs.Number(label="Total Calcium"),
gr.inputs.Number(label="Total Protein"),
gr.inputs.Number(label="Albumin")],
outputs=gr.outputs.Textbox(label="Status of Actual Hypocalcemia "),
title="Artificial Neural Network Assisted True Hypocalcemia Prediction")
interface.launch()