|
|
import joblib |
|
|
import numpy as np |
|
|
import gradio as gr |
|
|
|
|
|
|
|
|
model = joblib.load("model.joblib") |
|
|
|
|
|
|
|
|
def predict(input1, input2, input3): |
|
|
inputs = np.array([[input1, input2, input3]]) |
|
|
prediction = model.predict(inputs) |
|
|
return str(prediction[0]) |
|
|
|
|
|
|
|
|
interface = gr.Interface( |
|
|
fn=predict, |
|
|
inputs=[ |
|
|
gr.Number(label="Feature 1"), |
|
|
gr.Number(label="Feature 2"), |
|
|
gr.Number(label="Feature 3") |
|
|
], |
|
|
outputs="text", |
|
|
title="Datathon Model Predictor", |
|
|
description="Enter 3 features to get prediction from the deployed model." |
|
|
) |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
interface.launch() |
|
|
|