sales_pharma / app.py
Snigs98's picture
Upload 2 files
1543d15 verified
raw
history blame contribute delete
823 Bytes
import gradio as gr
import joblib
import numpy as np
# Load trained model
model = joblib.load("pharmacy_inventory_model.pkl")
# Prediction function
def predict_demand(year, month, hour, weekday):
data = np.array([[year, month, hour, weekday]])
prediction = model.predict(data)
return f"Predicted Total Medicine Demand: {prediction[0]:.2f}"
# Gradio Interface
interface = gr.Interface(
fn=predict_demand,
inputs=[
gr.Number(label="Year"),
gr.Number(label="Month (1-12)"),
gr.Number(label="Hour (0-276)"),
gr.Number(label="Weekday (0=Mon, 6=Sun)")
],
outputs="text",
title="Pharmacy Inventory Prediction System",
description="AI model to predict pharmacy medicine demand based on date and time."
)
interface.launch()