gracialy's picture
add gradio
46e8693
import joblib
import numpy as np
import gradio as gr
# Load your trained model
model = joblib.load("model.joblib")
# Define the prediction function
def predict(input1, input2, input3):
inputs = np.array([[input1, input2, input3]])
prediction = model.predict(inputs)
return str(prediction[0]) # Convert to string for display
# Build the Gradio interface
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."
)
# Run the app
if __name__ == "__main__":
interface.launch()