Spaces:
Sleeping
Sleeping
Fix: Readme
Browse files- .env +2 -0
- src/agri_predict/__pycache__/__init__.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/config.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/constants.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/data.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/features.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/models.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/plotting.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/scraper.cpython-312.pyc +0 -0
- src/agri_predict/__pycache__/utils.cpython-312.pyc +0 -0
- streamlit_app.py +3 -5
.env
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MONGO_URI=mongodb+srv://Agripredict:TjXSvMhOis49qH8E@cluster0.gek7n.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
|
| 2 |
+
PROD=False
|
src/agri_predict/__pycache__/__init__.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/__init__.cpython-312.pyc and b/src/agri_predict/__pycache__/__init__.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/config.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/config.cpython-312.pyc and b/src/agri_predict/__pycache__/config.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/constants.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/constants.cpython-312.pyc and b/src/agri_predict/__pycache__/constants.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/data.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/data.cpython-312.pyc and b/src/agri_predict/__pycache__/data.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/features.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/features.cpython-312.pyc and b/src/agri_predict/__pycache__/features.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/models.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/models.cpython-312.pyc and b/src/agri_predict/__pycache__/models.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/plotting.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/plotting.cpython-312.pyc and b/src/agri_predict/__pycache__/plotting.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/scraper.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/scraper.cpython-312.pyc and b/src/agri_predict/__pycache__/scraper.cpython-312.pyc differ
|
|
|
src/agri_predict/__pycache__/utils.cpython-312.pyc
CHANGED
|
Binary files a/src/agri_predict/__pycache__/utils.cpython-312.pyc and b/src/agri_predict/__pycache__/utils.cpython-312.pyc differ
|
|
|
streamlit_app.py
CHANGED
|
@@ -36,9 +36,8 @@ def get_cached_collections():
|
|
| 36 |
return get_collections()
|
| 37 |
|
| 38 |
|
| 39 |
-
@st.cache_data(ttl=300) # Cache for 5 minutes
|
| 40 |
def load_all_data(_collection):
|
| 41 |
-
"""Load
|
| 42 |
data = list(_collection.find({}))
|
| 43 |
if not data:
|
| 44 |
return pd.DataFrame()
|
|
@@ -59,9 +58,8 @@ def load_all_data(_collection):
|
|
| 59 |
return df
|
| 60 |
|
| 61 |
|
| 62 |
-
@st.cache_data(ttl=300)
|
| 63 |
def get_filtered_data(_collection, state=None, market=None, days=30):
|
| 64 |
-
"""Get filtered
|
| 65 |
query_filter = {"Reported Date": {"$gte": datetime.now() - timedelta(days=days)}}
|
| 66 |
if state and state != 'India':
|
| 67 |
query_filter["State Name"] = state
|
|
@@ -151,7 +149,7 @@ if st.session_state.authenticated:
|
|
| 151 |
|
| 152 |
if st.sidebar.button("✨ Let's go!"):
|
| 153 |
try:
|
| 154 |
-
#
|
| 155 |
state_param = selected_state if selected_state != 'India' else None
|
| 156 |
market_param = selected_market if market_wise else None
|
| 157 |
df = get_filtered_data(collection, state_param, market_param, st.session_state.selected_period)
|
|
|
|
| 36 |
return get_collections()
|
| 37 |
|
| 38 |
|
|
|
|
| 39 |
def load_all_data(_collection):
|
| 40 |
+
"""Load all data from MongoDB collection."""
|
| 41 |
data = list(_collection.find({}))
|
| 42 |
if not data:
|
| 43 |
return pd.DataFrame()
|
|
|
|
| 58 |
return df
|
| 59 |
|
| 60 |
|
|
|
|
| 61 |
def get_filtered_data(_collection, state=None, market=None, days=30):
|
| 62 |
+
"""Get filtered data based on parameters."""
|
| 63 |
query_filter = {"Reported Date": {"$gte": datetime.now() - timedelta(days=days)}}
|
| 64 |
if state and state != 'India':
|
| 65 |
query_filter["State Name"] = state
|
|
|
|
| 149 |
|
| 150 |
if st.sidebar.button("✨ Let's go!"):
|
| 151 |
try:
|
| 152 |
+
# Load data
|
| 153 |
state_param = selected_state if selected_state != 'India' else None
|
| 154 |
market_param = selected_market if market_wise else None
|
| 155 |
df = get_filtered_data(collection, state_param, market_param, st.session_state.selected_period)
|