Spaces:
Building
Building
Fix: Readme
Browse files
README.md
CHANGED
|
@@ -1,34 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# AgriPredict (Refactor)
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
| 8 |
-
- `config.py` - env & MongoDB connection helpers
|
| 9 |
-
- `constants.py` - shared constants (state/market mapping)
|
| 10 |
-
- `features.py` - feature engineering functions
|
| 11 |
-
- `data.py` - data access, preprocessing and scraping helpers
|
| 12 |
-
- `models.py` - model training, grid search and forecasting
|
| 13 |
-
- `plotting.py` - plotting and download helpers
|
| 14 |
-
- `utils.py` - authentication and utility functions
|
| 15 |
-
- `streamlit_app.py` - Streamlit entrypoint
|
| 16 |
-
- `requirements.txt` - Python dependencies
|
| 17 |
|
| 18 |
-
Run
|
| 19 |
|
| 20 |
-
1. Create
|
| 21 |
|
| 22 |
```bash
|
| 23 |
python -m venv .venv
|
| 24 |
source .venv/bin/activate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
pip install -r requirements.txt
|
| 26 |
```
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
```bash
|
| 33 |
streamlit run streamlit_app.py
|
| 34 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```
|
| 2 |
+
---
|
| 3 |
+
title: AgriPredict
|
| 4 |
+
emoji: πΎ
|
| 5 |
+
sdk: streamlit
|
| 6 |
+
app_file: streamlit_app.py
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
# AgriPredict (Refactor)
|
| 11 |
|
| 12 |
+
AgriPredict is a refactored, modular, and production-ready version of the original Streamlit-based price forecasting dashboard.
|
| 13 |
+
This version focuses on better structure, maintainability, and performance.
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## π Project Structure
|
| 18 |
+
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
src/agri_predict/
|
| 22 |
+
β
|
| 23 |
+
βββ config.py # Environment variables, MongoDB client setup
|
| 24 |
+
βββ constants.py # Shared constant mappings (states, markets, crops etc.)
|
| 25 |
+
βββ features.py # Feature engineering functions
|
| 26 |
+
βββ data.py # Data access, scraping, cleaning, preprocessing
|
| 27 |
+
βββ models.py # Model training, forecasting, grid search
|
| 28 |
+
βββ plotting.py # Plot utilities, downloads
|
| 29 |
+
βββ utils.py # Authentication + general helpers
|
| 30 |
+
|
| 31 |
+
streamlit_app.py # Streamlit UI entrypoint
|
| 32 |
+
requirements.txt # Python dependencies
|
| 33 |
|
| 34 |
+
````
|
| 35 |
|
| 36 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
## βΆοΈ Run Locally
|
| 39 |
|
| 40 |
+
### 1. Create and activate a virtual environment:
|
| 41 |
|
| 42 |
```bash
|
| 43 |
python -m venv .venv
|
| 44 |
source .venv/bin/activate
|
| 45 |
+
````
|
| 46 |
+
|
| 47 |
+
### 2. Install dependencies:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
pip install -r requirements.txt
|
| 51 |
```
|
| 52 |
|
| 53 |
+
### 3. Set up environment variables
|
| 54 |
+
|
| 55 |
+
Create a `.env` file in the **project root**:
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
MONGO_URI=your_mongo_connection_string
|
| 59 |
+
```
|
| 60 |
|
| 61 |
+
### 4. Start the Streamlit app:
|
| 62 |
|
| 63 |
```bash
|
| 64 |
streamlit run streamlit_app.py
|
| 65 |
```
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## π Deploy on Hugging Face Spaces
|
| 70 |
+
|
| 71 |
+
This README already includes the required HF metadata block at the top:
|
| 72 |
+
|
| 73 |
+
```md
|
| 74 |
+
---
|
| 75 |
+
title: AgriPredict
|
| 76 |
+
emoji: πΎ
|
| 77 |
+
sdk: streamlit
|
| 78 |
+
app_file: streamlit_app.py
|
| 79 |
+
pinned: false
|
| 80 |
+
---
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
Hugging Face will automatically run:
|
| 84 |
+
|
| 85 |
+
```
|
| 86 |
+
streamlit run streamlit_app.py
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
No extra configuration needed.
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## π¬ Contact
|
| 94 |
+
|
| 95 |
+
If you face any issues deploying to Hugging Face, reach out or open an issue in the repository.
|
| 96 |
+
|
| 97 |
+
```
|