--- title: AgriPredict emoji: 🌾 colorFrom: green colorTo: yellow sdk: streamlit sdk_version: "1.49.1" app_file: streamlit_app.py pinned: false --- # AgriPredict (Refactor) AgriPredict is a refactored, modular, and production-ready version of the original Streamlit-based price forecasting dashboard. This version focuses on better structure, maintainability, and performance. --- ## 📁 Project Structure ``` src/agri_predict/ │ ├── config.py # Environment variables, MongoDB client setup ├── constants.py # Shared constant mappings (states, markets, crops etc.) ├── features.py # Feature engineering functions ├── data.py # Data access, scraping, cleaning, preprocessing ├── models.py # Model training, forecasting, grid search ├── plotting.py # Plot utilities, downloads └── utils.py # Authentication + general helpers streamlit_app.py # Streamlit UI entrypoint requirements.txt # Python dependencies ``` --- ## ▶️ Run Locally ### 1. Create and activate a virtual environment: ```bash python -m venv .venv source .venv/bin/activate ``` ### 2. Install dependencies: ```bash pip install -r requirements.txt ``` ### 3. Set up environment variables Create a `.env` file in the **project root**: ``` MONGO_URI=your_mongo_connection_string ``` ### 4. Start the Streamlit app: ```bash streamlit run streamlit_app.py ``` --- ## 🚀 Deploy on Hugging Face Spaces This README already includes the required HF metadata block at the top. Hugging Face Spaces will automatically run: ``` streamlit run streamlit_app.py ``` No additional configuration is needed. ---