import gradio as gr import joblib import numpy as np # Load the trained model model = joblib.load("drug_model.pkl") # Prediction function def predict(age, gene1, gene2, gene3, dosage): input_data = np.array([[age, gene1, gene2, gene3, dosage]]) prediction = model.predict(input_data) return float(prediction[0]) # Gradio Interface interface = gr.Interface( fn=predict, inputs=[ gr.Number(label="Age"), gr.Number(label="Gene Marker 1"), gr.Number(label="Gene Marker 2"), gr.Number(label="Gene Marker 3"), gr.Number(label="Drug Dosage (mg)") ], outputs=gr.Number(label="Predicted Drug Effectiveness"), title="Drug Response Prediction App", description="Enter patient details and drug dosage to predict drug effectiveness." ) interface.launch(share=True)