Downloads · 30 days
0
Sicnarf01/agrigpt_expert
agrigpt_expert is a machine learning model from Sicnarf01. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
--- AgriGPT: Agricultural Expert Chatbot AgriGPT is an AI-powered chatbot designed to provide instant agricultural advice to farmers. It addresses common challenges such as pest control, crop management, weather forec…
Downloads · 30 days
0
Access
Public
Updated Feb 13, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md2.6 KB · 63%
From the Hugging Face model README
---# AgriGPT: Agricultural Expert Chatbot
AgriGPT is an AI-powered chatbot designed to provide instant agricultural advice to farmers. It addresses common challenges such as pest control, crop management, weather forecasting, and market price updates. The goal is to improve productivity, reduce costs, and empower smallholder farmers with actionable insights.
Install the required libraries:
pip install transformers torch tensorflow opencv-python flask
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("agri_expert/agrigpt")
model = AutoModelForSeq2SeqLM.from_pretrained("agri_expert/agrigpt")
def get_response(query):
inputs = tokenizer(query, return_tensors="pt")
outputs = model.generate(**inputs)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
import tensorflow as tf
# Load the model
model = tf.keras.models.load_model("crop_monitoring/model.h5")
# Predict crop health
def predict_crop_health(image_path):
img = tf.keras.preprocessing.image.load_img(image_path, target_size=(224, 224))
img_array = tf.keras.preprocessing.image.img_to_array(img)
img_array = tf.expand_dims(img_array, 0) / 255.0
predictions = model.predict(img_array)
label = labels[np.argmax(predictions)]
return label
Requirements
Python 3.8+
Libraries: transformers, torch, tensorflow, opencv-python, flask