Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
284 changes: 284 additions & 0 deletions NeuralNexus_19/AIML_Piyush/CNN(Model-Plants).ipynb

Large diffs are not rendered by default.

670 changes: 670 additions & 0 deletions NeuralNexus_19/AIML_Piyush/CNN(model-flower).ipynb

Large diffs are not rendered by default.

Binary file not shown.
1 change: 1 addition & 0 deletions NeuralNexus_19/AIML_Piyush/temp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added NeuralNexus_19/Backend_Himanshu/agrinexus.db
Binary file not shown.
188 changes: 188 additions & 0 deletions NeuralNexus_19/Backend_Himanshu/fastapi.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "461a4a17-5e66-450d-b7c4-e36af185c037",
"metadata": {},
"outputs": [],
"source": [
"from fastapi import FastAPI\n",
"from pydantic import BaseModel\n",
"import sqlite3\n",
"app = FastAPI()\n",
"\n",
"conn = sqlite3.connect(\"agrinexus.db\", check_same_thread=False)\n",
"cursor = conn.cursor()\n",
"cursor.execute(\"CREATE TABLE IF NOT EXISTS crops (id INTEGER PRIMARY KEY, name TEXT, disease TEXT, treatment TEXT)\")\n",
"conn.commit()\n",
"\n",
"class CropData(BaseModel):\n",
" name: str\n",
" disease: str\n",
" treatment: str\n",
"\n",
"@app.get(\"/\")\n",
"def home():\n",
" return {\"message\": \"Welcome to AgriNexus API\"}\n",
"@app.post(\"/add_crop/\")\n",
"def add_crop(data: CropData):\n",
" cursor.execute(\"INSERT INTO crops (name, disease, treatment) VALUES (?, ?, ?)\", \n",
" (data.name, data.disease, data.treatment))\n",
" conn.commit()\n",
" return {\"status\": \"Crop added successfully\"}\n",
"@app.get(\"/get_crops/\")\n",
"def get_crops():\n",
" cursor.execute(\"SELECT * FROM crops\")\n",
" crops = cursor.fetchall()\n",
" return {\"data\": crops}\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "00f5f699-fb65-4851-aa02-c8af0cdc842b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pymysql in c:\\users\\piyush\\anaconda3\\lib\\site-packages (1.1.1)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install pymysql"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5628aa80-af48-49ec-9283-5c5a50199a82",
"metadata": {},
"outputs": [],
"source": [
"import pymysql\n",
"\n",
"conn = pymysql.connect(\n",
" host=\"localhost\", \n",
" user=\"root\", \n",
" password=\"12345678\", \n",
" database=\"agrinexus_db\" \n",
")\n",
"cursor = conn.cursor()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cda04872-a45b-4e36-a6b1-fd9a84bad9b9",
"metadata": {},
"outputs": [],
"source": [
"conn = pymysql.connect(\n",
" host=\"mysql.server.com\", \n",
" user=\"you_par_cloud_user\",\n",
" password=\"your_cloudssword\",\n",
" database=\"your_cloud_db\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "6dfd2bfb-c055-4ce7-818d-b8aa0991542b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pymysql in c:\\users\\piyush\\anaconda3\\lib\\site-packages (1.1.1)\n",
"Requirement already satisfied: fastapi in c:\\users\\piyush\\anaconda3\\lib\\site-packages (0.115.8)\n",
"Requirement already satisfied: uvicorn in c:\\users\\piyush\\anaconda3\\lib\\site-packages (0.34.0)\n",
"Requirement already satisfied: starlette<0.46.0,>=0.40.0 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from fastapi) (0.45.3)\n",
"Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from fastapi) (2.5.3)\n",
"Requirement already satisfied: typing-extensions>=4.8.0 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from fastapi) (4.11.0)\n",
"Requirement already satisfied: click>=7.0 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from uvicorn) (8.1.7)\n",
"Requirement already satisfied: h11>=0.8 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from uvicorn) (0.14.0)\n",
"Requirement already satisfied: colorama in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from click>=7.0->uvicorn) (0.4.6)\n",
"Requirement already satisfied: annotated-types>=0.4.0 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4->fastapi) (0.6.0)\n",
"Requirement already satisfied: pydantic-core==2.14.6 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4->fastapi) (2.14.6)\n",
"Requirement already satisfied: anyio<5,>=3.6.2 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from starlette<0.46.0,>=0.40.0->fastapi) (4.2.0)\n",
"Requirement already satisfied: idna>=2.8 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from anyio<5,>=3.6.2->starlette<0.46.0,>=0.40.0->fastapi) (3.7)\n",
"Requirement already satisfied: sniffio>=1.1 in c:\\users\\piyush\\anaconda3\\lib\\site-packages (from anyio<5,>=3.6.2->starlette<0.46.0,>=0.40.0->fastapi) (1.3.0)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install pymysql fastapi uvicorn\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "962fee85-50c3-483b-8ebc-16b122aa1ba5",
"metadata": {},
"outputs": [],
"source": [
"from fastapi import FastAPI, Depends\n",
"import pymysql\n",
"from pymysql.cursors import DictCursor\n",
"\n",
"app = FastAPI()\n",
"HOST = \"localhost\" \n",
"USER = \"root\" \n",
"PASSWORD = \"12345678\" \n",
"DATABASE = \"agrinexus_db\" \n",
"\n",
"\n",
"def get_db_connection():\n",
" connection = pymysql.connect(\n",
" host=HOST,\n",
" user=USER,\n",
" password=PASSWORD,\n",
" database=DATABASE,\n",
" cursorclass=DictCursor \n",
" )\n",
" return connection\n",
"\n",
"@app.get(\"/\")\n",
"def read_root():\n",
" connection = get_db_connection()\n",
" try:\n",
" with connection.cursor() as cursor:\n",
" \n",
" cursor.execute(\"SELECT * FROM your_table LIMIT 10;\")\n",
" result = cursor.fetchall() \n",
" return {\"data\": result}\n",
" finally:\n",
" connection.close() "
]
}
],
"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.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
49 changes: 49 additions & 0 deletions NeuralNexus_19/Backend_Himanshu/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from fastapi import FastAPI
from pydantic import BaseModel
import sqlite3
import pymysql

app = FastAPI()

sqlite_conn = sqlite3.connect("agrinexus.db", check_same_thread=False)
sqlite_cursor = sqlite_conn.cursor()
sqlite_cursor.execute("CREATE TABLE IF NOT EXISTS crops (id INTEGER PRIMARY KEY, name TEXT, disease TEXT, treatment TEXT)")
sqlite_conn.commit()

try:
mysql_conn = pymysql.connect(
host="localhost",
user="root",
password="12345678",
database="agrinexus_db"
)
mysql_cursor = mysql_conn.cursor()
print("Successfully connected to MySQL database")
except Exception as e:
print("MySQL Connection Error:", e)
mysql_conn = None # Ensure mysql_conn is not used if connection fails

class CropData(BaseModel):
name: str
disease: str
treatment: str

@app.get("/")
def home():
return {"message": "Welcome to AgriNexus API"}

@app.post("/add_crop/")
def add_crop(data: CropData):
sqlite_cursor.execute("INSERT INTO crops (name, disease, treatment) VALUES (?, ?, ?)",
(data.name, data.disease, data.treatment))
sqlite_conn.commit()
return {"status": "Crop added successfully"}

@app.get("/get_crops/")
def get_crops():
sqlite_cursor.execute("SELECT * FROM crops")
crops = sqlite_cursor.fetchall()

crop_list = [{"id": row[0], "name": row[1], "disease": row[2], "treatment": row[3]} for row in crops]

return {"data": crop_list}
24 changes: 24 additions & 0 deletions NeuralNexus_19/Frontend_Pardeep/apk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions NeuralNexus_19/Frontend_Pardeep/apk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
38 changes: 38 additions & 0 deletions NeuralNexus_19/Frontend_Pardeep/apk/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]
13 changes: 13 additions & 0 deletions NeuralNexus_19/Frontend_Pardeep/apk/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading