{"files": [{"file_name": "readme.md", "body": "# FastAPI App\n\nThis is a FastAPI app that provides some basic math functions.\n\n## Usage\n\nTo use this app, follow the instructions below:\n\n1. Install the required dependencies by running `pip install -r requirements.txt`.\n2. Start the app by running `uvicorn main:app --reload`.\n3. Open your browser and navigate to `http://localhost:8000/docs` to access the Swagger UI documentation.\n\n## Example\n\nTo perform a basic math operation, you can use the following curl command:\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"operation\": \"add\", \"operands\": [2, 3]}' http://localhost:8000/calculate\n```\n"}, {"file_name": "main.py", "body": "from fastapi import FastAPI\nfrom pydantic import BaseModel\n\napp = FastAPI()\n\n\nclass Operation(BaseModel):\n    operation: str\n    operands: list\n\n\n@app.post('/calculate')\nasync def calculate(operation: Operation):\n    if operation.operation == 'add':\n        result = sum(operation.operands)\n    elif operation.operation == 'subtract':\n        result = operation.operands[0] - sum(operation.operands[1:])\n    elif operation.operation == 'multiply':\n        result = 1\n        for operand in operation.operands:\n            result *= operand\n    elif operation.operation == 'divide':\n        result = operation.operands[0]\n        for operand in operation.operands[1:]:\n            result /= operand\n    else:\n        result = None\n    return {'result': result}\n"}, {"file_name": "requirements.txt", "body": "fastapi\nuvicorn\npydantic"}]}