from smolagents import Tool import requests class ImageAnalysisTool(Tool): name = "image_analysis" description = "Analyzes an image and extracts text." inputs = { "image_path": { "type": "string", "description": "Path to the image file" } } output_type = "string" def forward(self, image_path: str) -> str: with open(image_path, "rb") as f: response = requests.post( "https://ankitaofficialdutta02--modal-image-analyzer-fastapi-app.modal.run/analyze-image/", files={"file": f} ) return response.json().get("text", "No text found in the image.")