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"The Actual Calcium value with Correction is {predicted_value:.2f}. The model is a RDF Regression Model with a MSE of 0.06 and R-squared of 0.931." # Define the Gradio interface interface = gr.Interface(fn=predict_corrected_calcium, inputs=[gr.inputs.Number(label="Total Calcium in mg/dL"), gr.inputs.Number(label="Total Protein in g/dL"), gr.inputs.Number(label="Albumin in g/dL")], outputs=gr.outputs.Textbox()) interface.launch()