| import os |
| import streamlit as st |
| from dotenv import load_dotenv |
|
|
| |
| load_dotenv() |
| GROQ_API_KEY = os.getenv("GROQ_API_KEY") |
|
|
| |
| if not GROQ_API_KEY: |
| st.error("API key is missing. Please check your .env file.") |
| st.stop() |
|
|
| |
| inventory = { |
| "Panadol": {"stock": 15, "limit": 10}, |
| "Brufen": {"stock": 20, "limit": 5}, |
| |
| |
| "Rigix": {"stock": 5, "limit": 5}, |
| "Zyrtec": {"stock": 8, "limit": 3}, |
| |
| |
| "Augmentin": {"stock": 12, "limit": 6}, |
| "Flagyl": {"stock": 18, "limit": 7}, |
| |
| |
| "Ventolin": {"stock": 10, "limit": 5}, |
| |
| |
| "Lipitor": {"stock": 9, "limit": 4}, |
| "Plavix": {"stock": 6, "limit": 2}, |
| |
| |
| "Nexium": {"stock": 11, "limit": 5}, |
| "Zantac": {"stock": 10, "limit": 4}, |
| |
| |
| "Cipralex": {"stock": 7, "limit": 3}, |
| "Zoloft": {"stock": 7, "limit": 3}, |
| |
| |
| "Synthroid": {"stock": 13, "limit": 5}, |
| |
| |
| "Tamiflu": {"stock": 5, "limit": 2}, |
| |
| |
| "Voltaren": {"stock": 16, "limit": 6}, |
| |
| |
| "Xanax": {"stock": 8, "limit": 3}, |
| |
| |
| "Zocor": {"stock": 12, "limit": 5}, |
| |
| |
| "Dermovate Cream": {"stock": 20, "limit": 5}, |
| "Betnovate Cream": {"stock": 15, "limit": 5}, |
| "Fucidin Cream": {"stock": 10, "limit": 3}, |
| "Mupirocin Ointment": {"stock": 8, "limit": 2}, |
| "Hydrocortisone Cream": {"stock": 12, "limit": 4}, |
| |
| |
| "Vitamin C Tablets": {"stock": 25, "limit": 10}, |
| "Vitamin D3 Capsules": {"stock": 18, "limit": 7}, |
| "Vitamin B12 Tablets": {"stock": 20, "limit": 8}, |
| "Multivitamin Capsules": {"stock": 30, "limit": 10}, |
| "Calcium with Vitamin D Tablets": {"stock": 22, "limit": 9}, |
| "Omega-3 Fish Oil Capsules": {"stock": 15, "limit": 5}, |
| "Zinc Supplements": {"stock": 17, "limit": 6}, |
| "Iron Supplements": {"stock": 14, "limit": 5}, |
| } |
|
|
|
|
| |
| st.set_page_config(page_title="📦 Inventory Management Chatbot", layout="wide") |
| st.title("📦 Inventory Management Chatbot") |
| st.write("Track stock levels, get restock alerts, and manage your warehouse efficiently.") |
|
|
| |
| st.subheader("📊 Current Stock Levels") |
| for item, details in inventory.items(): |
| stock = details["stock"] |
| limit = details["limit"] |
| st.write(f"**{item.capitalize()}:** {stock} units (Reorder Level: {limit} units)") |
|
|
| |
| if stock <= limit: |
| st.warning(f"⚠️ **Low Stock Alert:** {item.capitalize()} has reached its reorder level! Consider restocking.") |
|
|
| st.markdown("---") |
|
|
| |
| def reduce_stock(medicine_name, reduction_amount): |
| if medicine_name in inventory: |
| current_stock = inventory[medicine_name]["stock"] |
| new_stock = max(current_stock - reduction_amount, 0) |
| inventory[medicine_name]["stock"] = new_stock |
| return current_stock, new_stock |
| else: |
| return None, None |
|
|
| |
| st.subheader("🔧 Update Stock Levels") |
| medicine_name = st.selectbox("Select Medicine to Reduce Stock:", list(inventory.keys())) |
| reduction_amount = st.number_input("Enter Quantity to Reduce:", min_value=1, step=1) |
|
|
| if st.button("Update Stock"): |
| before_stock, after_stock = reduce_stock(medicine_name, reduction_amount) |
| if before_stock is not None: |
| st.success(f"**{medicine_name.capitalize()}** stock reduced by {reduction_amount} units.") |
| st.write(f"**Previous Stock Level:** {before_stock} units") |
| st.write(f"**Current Stock Level:** {after_stock} units") |
| |
| if after_stock <= inventory[medicine_name]["limit"]: |
| st.warning(f"⚠️ **Low Stock Alert:** {medicine_name.capitalize()} has reached its reorder level! Consider restocking.") |
| else: |
| st.error("Invalid medicine selected.") |
|
|
| |
| st.markdown("---") |
| st.markdown("🔹 **Powered by Streamlit**") |
|
|