drrobot9's picture
Initial commit: FastAPI + Vision + LLM integration
9fc4da3 verified
raw
history blame contribute delete
727 Bytes
from fastapi import FastAPI, UploadFile, File, Form
from fastapi.responses import JSONResponse
from app.pipeline import plant_intelligence_pipeline
app = FastAPI(
title=" Plant Intelligence AI",
description="Hybrid Plant Identifier + Reasoning Assistant",
version="1.0.0",
)
@app.get("/")
def home():
return {"message": "Welcome to the Plant Intelligence AI "}
@app.post("/analyze")
async def analyze(file: UploadFile = File(...), query: str = Form("")):
try:
image_bytes = await file.read()
result = plant_intelligence_pipeline(image_bytes, user_query=query)
return JSONResponse(result)
except Exception as e:
return JSONResponse({"error": str(e)}, status_code=500)