File size: 747 Bytes
32daf8f 46e8693 32daf8f 46e8693 32daf8f 46e8693 32daf8f 46e8693 32daf8f 46e8693 32daf8f 46e8693 32daf8f 46e8693 |
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 |
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()
|