File size: 862 Bytes
60ad031
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
34
35
36
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)