Fixed plant description text

#1
by AntoineR974 - opened
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -226,12 +226,17 @@ def on_plant_selected(evt: gr.SelectData, user_id: str) -> str:
226
  if photo_path.exists():
227
  photo_md = f"![photo]({photo_path.as_posix()})\n\n"
228
 
 
 
 
 
 
229
  return f"""
230
- {photo_md}## ๐ŸŒฟ {p['genus']}
231
 
232
  | Confidence | Sunlight | Soil | Watering |
233
  |------------|----------|------|----------|
234
- | {p['confidence']}% | {p.get('sunlight','โ€”')} | {p.get('soil','โ€”')} | {p.get('watering_frequency_days','โ€”')} days |
235
 
236
  | Added | Last Watered |
237
  |--------|-------------|
 
226
  if photo_path.exists():
227
  photo_md = f"![photo]({photo_path.as_posix()})\n\n"
228
 
229
+ plant = Plant(p["genus"])
230
+ if plant.plant_name is not None:
231
+ name = plant.plant_name
232
+ else:
233
+ name = p["genus"]
234
  return f"""
235
+ {photo_md}## ๐ŸŒฟ {name} ({p['genus']})
236
 
237
  | Confidence | Sunlight | Soil | Watering |
238
  |------------|----------|------|----------|
239
+ | {p['confidence']}% | {p.get('sunlight','โ€”')} | {p.get('soil','โ€”')} | {p.get('watering_frequency_days','โ€”')} |
240
 
241
  | Added | Last Watered |
242
  |--------|-------------|