ML-Final-Exam / app.py
nagiur's picture
Upload 3 files
bbed4d0 verified
raw
history blame contribute delete
643 Bytes
import gradio as gr
import joblib
import numpy as np
# Load trained model
model = joblib.load("artifacts/model.pkl")
def predict(stock2, stock3, stock4, stock5):
# Convert input into correct shape (1 sample, 4 features)
input_data = np.array([[stock2, stock3, stock4, stock5]])
prediction = model.predict(input_data)[0]
return float(prediction)
iface = gr.Interface(
fn=predict,
inputs=[
gr.Number(label="Stock_2"),
gr.Number(label="Stock_3"),
gr.Number(label="Stock_4"),
gr.Number(label="Stock_5"),
],
outputs="number",
title="Stock Price Predictor"
)
iface.launch()