Sobit commited on
Commit
946687c
Β·
verified Β·
1 Parent(s): 4b701f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -6
app.py CHANGED
@@ -112,20 +112,43 @@ with st.sidebar:
112
 
113
  # Text-to-Speech Settings
114
  tts_enabled = st.checkbox("Enable Text-to-Speech", value=True)
115
- language = st.selectbox("Speech Language", options=["en", "es", "fr", "de"], format_func=lambda x: {
116
  "en": "English",
117
- "es": "Spanish",
118
- "fr": "French",
119
- "de": "German"
120
  }[x])
121
 
122
  if st.button("Clear Conversation History"):
123
  st.session_state.conversation_history = {}
124
  st.success("Conversation history cleared!")
125
 
126
- # User context input
 
127
  st.subheader("πŸ“ Provide Initial Context or Ask a Question")
128
- user_context = st.text_area("Enter any details, symptoms, or questions about the plant's condition.", placeholder="Example: My tomato plant leaves are turning yellow. Is it a disease or a nutrient deficiency?")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  # Upload an image
131
  uploaded_file = st.file_uploader("πŸ“€ Upload a plant image", type=["jpg", "jpeg", "png"])
 
112
 
113
  # Text-to-Speech Settings
114
  tts_enabled = st.checkbox("Enable Text-to-Speech", value=True)
115
+ language = st.selectbox("Speech Language", options=["en", "ne", "hi", "bn"], format_func=lambda x: {
116
  "en": "English",
117
+ "ne": "Nepali",
118
+ "hi": "Hindi",
119
+ "bn": "Bengali"
120
  }[x])
121
 
122
  if st.button("Clear Conversation History"):
123
  st.session_state.conversation_history = {}
124
  st.success("Conversation history cleared!")
125
 
126
+
127
+ # User context input with example prompts
128
  st.subheader("πŸ“ Provide Initial Context or Ask a Question")
129
+
130
+ # Generalized example prompts for easier input
131
+ example_prompts = {
132
+ "Select an example...": "",
133
+ "🌱 General Plant Health Issue": "My plant leaves are wilting and turning yellow. Is this a disease or a nutrient deficiency?",
134
+ "πŸ›‘ Leaf Spots and Discoloration": "I see dark spots on my crop leaves. Could this be a fungal or bacterial infection?",
135
+ "πŸ‚ Leaves Drying or Curling": "The leaves on my plants are curling and drying up. What could be causing this?",
136
+ "🧴 Pest or Disease?": "I noticed tiny insects on my plants along with some leaf damage. Could this be a pest problem or a disease?",
137
+ "πŸ’§ Overwatering or Root Rot?": "My plant leaves are turning brown and mushy. Is this due to overwatering or a root infection?",
138
+ "🌾 Poor Crop Growth": "My crops are growing very slowly and seem weak. Could this be due to soil problems or disease?",
139
+ "🌑️ Weather and Disease Connection": "It has been raining a lot, and now my plants have mold. Could the weather be causing a fungal disease?",
140
+ "🌍 Regional Disease Concern": "I'm in a humid area and my crops often get infected. What are common diseases for this climate?",
141
+ }
142
+
143
+ # Dropdown menu for selecting an example
144
+ selected_example = st.selectbox("Choose an example to auto-fill:", list(example_prompts.keys()))
145
+
146
+ # Auto-fill the text area when an example is selected
147
+ user_context = st.text_area(
148
+ "Enter details, symptoms, or a question about your plant condition.",
149
+ value=example_prompts[selected_example] if selected_example != "Select an example..." else "",
150
+ placeholder="Example: My plant leaves are turning yellow and wilting. Is this a disease or a nutrient issue?"
151
+ )
152
 
153
  # Upload an image
154
  uploaded_file = st.file_uploader("πŸ“€ Upload a plant image", type=["jpg", "jpeg", "png"])