Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -106,7 +106,7 @@ async def api_health_check():
|
|
106 |
|
107 |
|
108 |
@app.post("/predict/{plant_name}")
|
109 |
-
async def predict_plant_disease(plant_name: str, file: UploadFile = File(...)):
|
110 |
"""
|
111 |
API endpoint to predict plant disease from an uploaded image.
|
112 |
|
@@ -168,7 +168,7 @@ async def predict_plant_disease(plant_name: str, file: UploadFile = File(...)):
|
|
168 |
|
169 |
# Fetch additional data from external API
|
170 |
try:
|
171 |
-
response = requests.get(f"https://navpan2-sarva-ai-back.hf.space/kotlinback/{class_label}")
|
172 |
external_data = response.json() if response.status_code == 200 else {"error": "Failed to fetch external data"}
|
173 |
except Exception as e:
|
174 |
external_data = {"error": str(e)}
|
|
|
106 |
|
107 |
|
108 |
@app.post("/predict/{plant_name}")
|
109 |
+
async def predict_plant_disease(plant_name: str, file: UploadFile = File(...),lang: str = "en"):
|
110 |
"""
|
111 |
API endpoint to predict plant disease from an uploaded image.
|
112 |
|
|
|
168 |
|
169 |
# Fetch additional data from external API
|
170 |
try:
|
171 |
+
response = requests.get(f"https://navpan2-sarva-ai-back.hf.space/kotlinback/{class_label}?lang={lang}")
|
172 |
external_data = response.json() if response.status_code == 200 else {"error": "Failed to fetch external data"}
|
173 |
except Exception as e:
|
174 |
external_data = {"error": str(e)}
|