Update app.py
Browse files
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", "
|
116 |
"en": "English",
|
117 |
-
"
|
118 |
-
"
|
119 |
-
"
|
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 |
st.subheader("π Provide Initial Context or Ask a Question")
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"])
|