Spaces:
Sleeping
Sleeping
Create app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637import gradio as grimport pickleimport pandas as pd
# Load the saved modelwith open("model_AD.pkl", "rb") as f: model = pickle.load(f)
def predict_pcos(input_features): # Convert input features into a DataFrame (assuming 8 features here) input_data = pd.DataFrame([input_features], columns=["Age (yrs)", "BMI", "Weight (Kg)", "Cycle length(days)", "Follicle No. (L)", "Follicle No. (R)", "AMH(ng/mL)", "beta-HCG(mIU/mL)"])
# Predict using the loaded model prediction = model.predict(input_data)
return "PCOS Positive" if prediction[0] == 1 else "PCOS Negative"
# Define Gradio inputs and outputsiface = gr.Interface( fn=predict_pcos, inputs=[ gr.inputs.Number(label="Age (yrs)"), gr.inputs.Number(label="BMI"), gr.inputs.Number(label="Weight (Kg)"), gr.inputs.Number(label="Cycle length(days)"), gr.inputs.Number(label="Follicle No. (L)"), gr.inputs.Number(label="Follicle No. (R)"), gr.inputs.Number(label="AMH(ng/mL)"), gr.inputs.Number(label="beta-HCG(mIU/mL)") ], outputs="text", title="PCOS Detection", description="Predicts PCOS based on user-provided medical data.")
# Launch the Gradio interfaceiface.launch()app.pyAdded+37