Commit 85d4374c authored by H.G.A.G.Hathnapitiya's avatar H.G.A.G.Hathnapitiya

Upload New File

parent a34245c8
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "62f3f1a6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Press Enter to continue...10\n"
]
}
],
"source": [
"Day = int(input(\"Press Enter to continue...\"))"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "f1dfab9b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: gradio in /Users/asinduhathnapitiya/opt/anaconda3/lib/python3.9/site-packages (3.9.1)\n",
"\u001b[31mERROR: Could not find a version that satisfies the requirement as (from versions: none)\u001b[0m\n",
"\u001b[31mERROR: No matching distribution found for as\u001b[0m\n",
"\u001b[33mWARNING: You are using pip version 21.3.1; however, version 22.3.1 is available.\n",
"You should consider upgrading via the '/Users/asinduhathnapitiya/opt/anaconda3/bin/python -m pip install --upgrade pip' command.\u001b[0m\n"
]
}
],
"source": [
"!pip install gradio as gr"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "ec893fad",
"metadata": {},
"outputs": [],
"source": [
"day = Day"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "03e6bd10",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"day"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "4fa7d9dd",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"dataset = pd.read_excel(\"Plant_Life_Cycle_dataset3.xlsx\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a09631a8",
"metadata": {},
"outputs": [],
"source": [
"dataset[\"Days\"] = dataset[\"Days\"].fillna(0)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "f196882e",
"metadata": {},
"outputs": [],
"source": [
"dataset = dataset.astype({'Days':'int'})"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "7799bfd8",
"metadata": {},
"outputs": [],
"source": [
"record = dataset.loc[dataset[\"Days\"] == Day]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "4cb3e85b",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Unnamed: 0</th>\n",
" <th>Days</th>\n",
" <th>min_Height</th>\n",
" <th>max_Height</th>\n",
" <th>min_Leaves</th>\n",
" <th>max_Leaves</th>\n",
" <th>min_Area</th>\n",
" <th>max_Area</th>\n",
" <th>Remarks</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>9</td>\n",
" <td>10</td>\n",
" <td>9.0</td>\n",
" <td>15.2</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>17.64</td>\n",
" <td>22.0</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 Days min_Height max_Height min_Leaves max_Leaves min_Area \\\n",
"9 9 10 9.0 15.2 2 2 17.64 \n",
"\n",
" max_Area Remarks \n",
"9 22.0 NaN "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"record"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "7a6b0472",
"metadata": {},
"outputs": [],
"source": [
"min_Height = record._get_value(Day-1,'min_Height')\n",
"max_Height = record._get_value(Day-1,\"max_Height\")\n",
"min_Leaves = record._get_value(Day-1,\"min_Leaves\")\n",
"max_Leaves = record._get_value(Day-1,\"max_Leaves\")\n",
"min_Area = record._get_value(Day-1,\"min_Area\")\n",
"max_Area = record._get_value(Day-1,\"max_Area\")\n",
"Remarks = record._get_value(Day-1,\"Remarks\")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "2386ca7e",
"metadata": {},
"outputs": [],
"source": [
"source = '7.jpeg'"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "17e68696",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ROOT /Users/asinduhathnapitiya/Desktop/Research1/yolov5\n",
"\u001b[34m\u001b[1mNewdetectforIpynb: \u001b[0mweights=['best.pt'], value=0, min_Height=0, max_Height=0, Height=2, min_Leaves=0, max_Leaves=0, min_Area=0, max_Area=0, Remarks=0, source=7.jpeg, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=., name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False\n",
"YOLOv5 🚀 v6.1-142-g918d7b2 torch 1.11.0 CPU\n",
"\n",
"Fusing layers... \n",
"[W NNPACK.cpp:51] Could not initialize NNPACK! Reason: Unsupported hardware.\n",
"YOLOv5s summary: 213 layers, 7058671 parameters, 0 gradients\n",
"Spread Area = \", 38.66cm\n",
"Total Leaves 3\n",
"min 0 Max 0\n",
"\"Standard Height = \", 0 ,\"between \", 0\n",
"\"Standard Total Leaves =\", 0 ,\"between \", 0\n",
"\"Standard Spread Area = \", 0 ,\"between \", 0\n",
"0 38.659846093749984 0\n",
"Traceback (most recent call last):\n",
" File \"/Users/asinduhathnapitiya/Desktop/Research1/yolov5/NewdetectforIpynb.py\", line 407, in <module>\n",
" main(opt)\n",
" File \"/Users/asinduhathnapitiya/Desktop/Research1/yolov5/NewdetectforIpynb.py\", line 402, in main\n",
" run(**vars(opt))\n",
" File \"/Users/asinduhathnapitiya/opt/anaconda3/lib/python3.9/site-packages/torch/autograd/grad_mode.py\", line 27, in decorate_context\n",
" return func(*args, **kwargs)\n",
" File \"/Users/asinduhathnapitiya/Desktop/Research1/yolov5/NewdetectforIpynb.py\", line 281, in run\n",
" if len(det) < min_Leaves[0] and spreadArea < min_Area[0]:\n",
"TypeError: 'int' object is not subscriptable\n"
]
}
],
"source": [
"!python NewdetectforIpynb.py --weight best.pt --source {source} "
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "709c312b",
"metadata": {},
"outputs": [],
"source": [
"recommendation = pd.read_csv(\"test.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "7b58f205",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"State Of the Plant is -- Plant is not reach to the standard height\n",
"Recommendation to the Plant is -- It may have Calcium deficiency. Solution :::: Add Calcium containing fertilizers like lime or sypsum\n"
]
}
],
"source": [
"State = recommendation._get_value(0,\"State\")\n",
"recomnd1 = recommendation._get_value(0,\"recommendation1\")\n",
"recomnd2 = recommendation._get_value(0,\"recommendation2\")\n",
"\n",
"print(f'State Of the Plant is -- {State}')\n",
"if len(str(recomnd2)) > 5:\n",
" print(f'Recommendation to the Plant is -- {recomnd2}')\n",
"\n",
"if len(str(recomnd1)) > 5:\n",
" print(f'Recommendation to the Plant is -- {recomnd1}')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7db0a3e4",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "327bc172",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment