@app.get("/calculate-food") def calculate_food_endpoint(activity: int, weight: int): """ Calculates the recommended amount of dog food based on activity level and weight. Args: activity: The dog's activity level, as a number from 1 to 5. weight: The dog's weight in kilograms. Returns: A JSON object containing the recommended amount of food in cups. """ # Check if the activity and weight parameters are present in the API request. if activity is None or weight is None: return {"error": "Please provide both activity level and weight."} # Calculate the recommended amount of food. result = calculate_food(activity, weight) # Respond with the result as JSON. return result