Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,53 @@ st.set_page_config(
|
|
| 22 |
initial_sidebar_state="auto" # Auto-hide sidebar on small screens
|
| 23 |
)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# Custom CSS for styling
|
| 26 |
# Update custom CSS
|
| 27 |
custom_css = """
|
|
@@ -240,17 +287,18 @@ def translate_text(text):
|
|
| 240 |
return text
|
| 241 |
return text
|
| 242 |
|
|
|
|
| 243 |
def main():
|
| 244 |
-
st.sidebar.title("Settings")
|
| 245 |
-
st.sidebar.info("Choose language and plant type, then upload an image to classify the disease.")
|
| 246 |
-
language_option = st.sidebar.radio("Language", options=["English", "Marathi"], index=0)
|
| 247 |
st.session_state.language = language_option
|
| 248 |
-
plant_type = st.sidebar.selectbox("Select Plant Type", options=['sugarcane', 'maize', 'cotton', 'rice', 'wheat'])
|
| 249 |
uploaded_file = st.sidebar.file_uploader(
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
)
|
| 254 |
st.title(translate_text("Krushi Mitra"))
|
| 255 |
st.write(translate_text("Plant Disease Classification and Pesticide Recommendation.\n\nUpload an image, select plant type, and click on Classify."))
|
| 256 |
|
|
|
|
| 22 |
initial_sidebar_state="auto" # Auto-hide sidebar on small screens
|
| 23 |
)
|
| 24 |
|
| 25 |
+
# Improved translations dictionary
|
| 26 |
+
TRANSLATIONS = {
|
| 27 |
+
# Common Website Words
|
| 28 |
+
"Upload": "अपलोड करा",
|
| 29 |
+
"Select": "निवडा",
|
| 30 |
+
"Image": "प्रतिमा",
|
| 31 |
+
"Settings": "सेटिंग्ज",
|
| 32 |
+
"Language": "भाषा",
|
| 33 |
+
"Plant": "पीक",
|
| 34 |
+
"Disease": "रोग",
|
| 35 |
+
"Classify": "वर्गीकृत करा",
|
| 36 |
+
"Recommended": "शिफारस केलेला",
|
| 37 |
+
"More": "अधिक",
|
| 38 |
+
"Read": "वाचा",
|
| 39 |
+
|
| 40 |
+
# Specific Phrases
|
| 41 |
+
"Krushi Mitra": "कृषी मित्र",
|
| 42 |
+
"Plant Disease Classification and Pesticide Recommendation": "पीक रोग वर्गीकरण आणि कीटकनाशक शिफारस",
|
| 43 |
+
"Upload a plant image...": "पीक प्रतिमा अपलोड करा...",
|
| 44 |
+
"Select an image of your plant to detect diseases": "रोग शोधण्यासाठी आपल्या पीकाची प्रतिमा निवडा",
|
| 45 |
+
"Uploaded Image": "अपलोड केलेली प्रतिमा",
|
| 46 |
+
"Classifying...": "वर्गीकरण करत आहे...",
|
| 47 |
+
"Classification Complete!": "वर्गीकरण पूर्ण झाले!",
|
| 48 |
+
"Predicted Class": "अनुमानित वर्ग",
|
| 49 |
+
"Recommended Pesticide": "शिफारस केलेला कीटकनाशक",
|
| 50 |
+
"Detailed Info": "विस्तृत माहिती",
|
| 51 |
+
"Commercial Products": "व्यावसायिक उत्पादने",
|
| 52 |
+
"More Articles": "अधिक लेख",
|
| 53 |
+
"Retrieving detailed plant information...": "पीकाची विस्तृत माहिती मिळवत आहे...",
|
| 54 |
+
"Detailed Plant Disease Information": "पीक रोगाची विस्तृत माहिती",
|
| 55 |
+
"Detailed information is not available at the moment.": "सध्या विस्तृत माहिती उपलब्ध नाही.",
|
| 56 |
+
"Additional Pesticide Recommendations": "अतिरिक्त कीटकनाशक शिफारसी",
|
| 57 |
+
"Title": "शीर्षक",
|
| 58 |
+
"Summary": "सारांश",
|
| 59 |
+
"Retrieving commercial product details...": "व्यावसायिक उत्पादन तपशील मिळवत आहे...",
|
| 60 |
+
"No commercial product details available.": "कोणतेही व्यावसायिक उत्पादन तपशील उपलब्ध नाहीत.",
|
| 61 |
+
"Retrieving additional articles...": "अतिरिक्त लेख मिळवत आहे...",
|
| 62 |
+
"No additional articles available.": "अतिरिक्त लेख उपलब्ध नाहीत.",
|
| 63 |
+
"Error in classification. Please try again.": "वर्गीकरणमध्ये त्रुटी. कृपया पुन्हा प्रयत्न करा.",
|
| 64 |
+
"Please upload an image from the sidebar to get started.": "सुरुवात करण्यासाठी कृपया बाजूच्या पट्टीतून एक प्रतिमा अपलोड करा."
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
def translate_text(text):
|
| 68 |
+
if st.session_state.get("language", "English") == "Marathi":
|
| 69 |
+
return TRANSLATIONS.get(text, text)
|
| 70 |
+
return text
|
| 71 |
+
|
| 72 |
# Custom CSS for styling
|
| 73 |
# Update custom CSS
|
| 74 |
custom_css = """
|
|
|
|
| 287 |
return text
|
| 288 |
return text
|
| 289 |
|
| 290 |
+
|
| 291 |
def main():
|
| 292 |
+
st.sidebar.title(translate_text("Settings"))
|
| 293 |
+
st.sidebar.info(translate_text("Choose language and plant type, then upload an image to classify the disease."))
|
| 294 |
+
language_option = st.sidebar.radio(translate_text("Language"), options=["English", "Marathi"], index=0)
|
| 295 |
st.session_state.language = language_option
|
| 296 |
+
plant_type = st.sidebar.selectbox(translate_text("Select Plant Type"), options=['sugarcane', 'maize', 'cotton', 'rice', 'wheat'])
|
| 297 |
uploaded_file = st.sidebar.file_uploader(
|
| 298 |
+
translate_text("Upload a plant image..."),
|
| 299 |
+
type=["jpg", "jpeg", "png"],
|
| 300 |
+
help=translate_text("Select an image of your plant to detect diseases")
|
| 301 |
+
)
|
| 302 |
st.title(translate_text("Krushi Mitra"))
|
| 303 |
st.write(translate_text("Plant Disease Classification and Pesticide Recommendation.\n\nUpload an image, select plant type, and click on Classify."))
|
| 304 |
|