2001muhammadumair commited on
Commit
946f87e
·
verified ·
1 Parent(s): a1c0116

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -30,15 +30,25 @@ def get_groq_response(prompt):
30
  st.title("Crop Advisory Chatbot")
31
  st.write("Provide your details to get personalized crop advice.")
32
 
33
- # Input fields for user details
34
- soil_type = st.text_input("Soil type (e.g., sandy, clay, loamy):")
35
- climate = st.text_input("Climate (e.g., hot, moderate, cold):")
 
 
 
 
 
 
 
 
 
36
  area_size = st.number_input("Area size in acres:", min_value=0.1, step=0.1)
37
- season = st.selectbox("Current season:", ["Select", "Summer", "Winter", "Rainy", "Autumn", "Spring"])
38
 
 
39
  if st.button("Get Advisory"):
40
  # Check if all fields are filled
41
- if soil_type and climate and area_size and season != "Select":
42
  # Prompts for different advisory features
43
  crop_recommendation_prompt = (
44
  f"Suggest suitable crops for soil type '{soil_type}', climate '{climate}', "
@@ -83,4 +93,4 @@ if st.button("Get Advisory"):
83
  st.warning("Please fill in all the details to get the advisory.")
84
 
85
  # To run the app in Colab, you need to use ngrok or run it locally with:
86
- # `streamlit run app.py`
 
30
  st.title("Crop Advisory Chatbot")
31
  st.write("Provide your details to get personalized crop advice.")
32
 
33
+ # Multiple-choice options for soil type
34
+ soil_type = st.selectbox("Soil Type:", [
35
+ "Select", "Alluvial Soil (Loamy and Clay)", "Sandy Soil",
36
+ "Mountain Soil", "Clay Soil", "Saline and Alkaline Soil"
37
+ ])
38
+
39
+ # Multiple-choice options for climate
40
+ climate = st.selectbox("Climate:", [
41
+ "Select", "Hot", "Moderate", "Cold"
42
+ ])
43
+
44
+ # Input for area size and season selection
45
  area_size = st.number_input("Area size in acres:", min_value=0.1, step=0.1)
46
+ season = st.selectbox("Current Season:", ["Select", "Summer", "Winter", "Rainy", "Autumn", "Spring"])
47
 
48
+ # Button to get advisory
49
  if st.button("Get Advisory"):
50
  # Check if all fields are filled
51
+ if soil_type != "Select" and climate != "Select" and area_size > 0 and season != "Select":
52
  # Prompts for different advisory features
53
  crop_recommendation_prompt = (
54
  f"Suggest suitable crops for soil type '{soil_type}', climate '{climate}', "
 
93
  st.warning("Please fill in all the details to get the advisory.")
94
 
95
  # To run the app in Colab, you need to use ngrok or run it locally with:
96
+ # `streamlit run app.py`