File size: 1,060 Bytes
0134561 bfad469 0134561 45792b9 5a95511 0134561 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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() |