from fastapi import FastAPI from fastapi.responses import HTMLResponse from pydantic import BaseModel from fastapi.staticfiles import StaticFiles # Create FastAPI instance app = FastAPI() # Request model class InputData(BaseModel): text: str # Mount the static folder app.mount("/static", StaticFiles(directory="static"), name="static") # Home Route with HTML page and description @app.get("/", response_class=HTMLResponse) async def home(): html_content = """ Solar AI Model

Welcome to the Solar Cell Detection AI Vision Models

AI in Solar

Cell1

AI in Solar

Cell2

AI in Solar

Cell3

AI in Solar

Cell4

AI in Solar

Cell5

AI in SolarSolar

Cell6

AI in Solar

Cell7

""" return HTMLResponse(content=html_content) # Prediction Route @app.post("/predict") async def predict(data: InputData): # Example: Simple text length prediction result = {"prediction": len(data.text)} return result