File size: 1,686 Bytes
1fd990b
 
 
c319a6d
 
1fd990b
43f3f8c
1fd990b
 
 
 
3029a46
 
1fd990b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c319a6d
3029a46
1fd990b
3029a46
1fd990b
3029a46
1fd990b
3029a46
 
 
 
c319a6d
1fd990b
 
 
 
3029a46
 
 
1fd990b
 
 
 
 
 
 
3029a46
1fd990b
3029a46
 
 
 
1fd990b
 
 
 
 
c319a6d
 
1fd990b
 
 
 
 
c319a6d
1fd990b
c319a6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
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.

---