Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
aashnajoshi committed Sep 30, 2024
1 parent 1a14c8f commit 4c5f61c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ TG_TOKEN="TG_BOT_TOKEN"
STABILITY_API_KEY = "YOUR_STABILITY_API_KEY"
YOUTUBE_API_KEY = "YOUR_YOUTUBE_API_KEY"

PLANT_API ="YOUR_PLANT_API_KEY"
PLANT_URL="https://api.plant.id/v3"
PLANT_API ="YOUR_PLANT_API_KEY"
22 changes: 6 additions & 16 deletions plant_id.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import requests
from kindwise import PlantApi, PlantIdentification, UsageInfo
from dotenv import load_dotenv
import os
from tkinter import Tk
Expand All @@ -7,23 +7,13 @@
load_dotenv()

def identify_plant(image_path):
api_key = os.getenv("PLANT_API")
url = os.getenv("PLANT_URL")
api = PlantApi(api_key= os.getenv("PLANT_API"))

# Logic to identify plant from the url and name

def print_plant_info(plant_data):
if 'suggestions' in plant_data and len(plant_data['suggestions']) > 0:
suggestion = plant_data['suggestions'][0]
print("Scientific Name:", suggestion['scientific_name'])
print("Common Name:", suggestion['common_names'])

if 'medicinal_uses' in suggestion and suggestion['medicinal_uses']:
print("Medicinal Uses:", suggestion['medicinal_uses'])
else:
print("No medicinal uses found.")
else:
print("No plant identified.")
usage: UsageInfo = api.usage_info()
identification: PlantIdentification = api.identify(image_path)
identification_with_different_views: PlantIdentification = api.get_identification(identification.access_token)
api.delete_identification(identification)

def main():
Tk().withdraw()
Expand Down

0 comments on commit 4c5f61c

Please sign in to comment.