from fastapi import FastAPI from transformers import pipeline # NOTE - we configure docs_url to serve the interactive Docs at the root path # of the app. This way, we can use the docs as a landing page for the app on Spaces. app = FastAPI(docs_url="/") @app.get("/food") def food_endpoint(breed: str): """ Using the text2text-generation pipeline from `transformers`, generate text from the given input text. The model used is `google/flan-t5-small`, which can be found [here](https://huggingface.co/google/flan-t5-small). """ if breed == 'Australian Shepherd': return "To make sure that your Australian Shepherd’s nutritional needs are met, start with high-quality puppy food or adult dog food.\nWhile Aussies may be considered a large breed if they grow to more than 50 pounds at maturity, their energy level is higher than many large breeds.\nIf your Aussie is very active, consider choosing an active or working breed formula. These foods will be higher in protein to support lean muscle mass and will contain higher fat and calorie content to keep up with their energy.\n\nHere are some additional things to look for in dog food for Australian Shepherds:\n\nA high-quality source of animal protein. Protein provides the building blocks for strong muscles. It should come from high-quality animal sources to maximize digestibility and to provide the essential amino acids your dog needs.\nModerate-to-high fat content. Fat provides a concentrated source of energy for dogs in the form of calories. Because Aussies are so energetic, they may require a higher fat content than average.\nNutritious and digestible carbohydrates. Whole grains, starchy vegetables, and fresh fruits are nutritious and digestible for dogs—they provide dietary fiber, essential nutrients, and energy. Just keep the carbohydrate content low and focus primarily on animal-based ingredients.\nWholesome, natural ingredients. Whole-food ingredients are the most nutritious and digestible ingredients for your dog, so avoid dog foods that contain by-products, fillers, and artificial additives. The shorter the ingredient list, the better.\nComplete and balanced nutrition. Make sure the food you choose carries an AAFCO statement of nutritional quality, certifying that the recipe is formulated to meet your dog’s minimum nutritional requirements." elif breed == 'Basset Hound': return "Basset Hounds are prone to obesity due to their low activity levels and tendency to overeat, so it’s important to select a dog food that is formulated to meet their specific energy requirements without overloading them with excessive calories.\n\nConsider a formula labeled for “less active” or “weight management” if your Basset Hound is overweight or prone to weight gain.\n\nBasset Hounds are susceptible to joint problems, including hip dysplasia and arthritis, so the food you choose should contain ingredients like glucosamine and chondroitin which can help support joint health and mobility.\n\nThis dog breed may also be prone to digestive issues, including bloating and gas. Choose a dog food that contains easily digestible ingredients, such as high-quality proteins and fibers. Avoid foods with excessive fillers or artificial additives that can contribute to digestive upset.\n\nAs always, ensure that the dog food you choose provides a balanced mix of proteins, fats, carbohydrates, vitamins, and minerals.\n\nOpt for a dog food that lists high-quality animal-based proteins as the main ingredients, such as chicken, turkey, or fish. These proteins provide essential amino acids for muscle development and maintenance.\n\nBasset Hounds may have food sensitivities or allergies, so be mindful of potential allergens in their food. If your Basset Hound exhibits signs of allergies or digestive issues, consult with your veterinarian to identify potential triggers and consider a limited ingredient diet or specialized formulas." elif breed == 'Bernedoodles': return "Look for commercially available dog foods that are labeled as complete and balanced to ensure they meet all the essential nutrients your Bernedoodle needs. Choose products with real meat (e.g., chicken, beef, or fish) listed as the first ingredient.\n\nDogs need protein for muscle development and overall health. Look for dog foods with a good source of animal-based protein, which is crucial for a Bernedoodle’s active lifestyle.\n\nFats provide a concentrated source of energy and are essential for maintaining a healthy coat and skin. Look for foods with moderate levels of healthy fats, such as omega-3 and omega-6 fatty acids.\n\nCarbohydrates from whole grains and vegetables can provide a source of energy for your Bernedoodle. Avoid dog foods with excessive amounts of fillers like corn, soy, and wheat.\n\nTry to steer clear of dog foods with artificial colors, flavors, and preservatives, as these may not be beneficial for your pet’s health.\n\nDepending on whether your Bernedoodle is a puppy, adult, or senior, their nutritional needs will vary. Ensure you choose a formula suitable for their life stage.\n\nSome Bernedoodles may have food sensitivities or allergies. If you notice any adverse reactions or digestive issues after feeding a certain type of food, consult your vet to identify the culprit.\n\nObesity can be an issue in some Bernedoodles, especially if they have a more sedentary lifestyle. Monitor their portion sizes and adjust as needed to maintain a healthy weight." else: return "Nutritional info currently not available for your breed. Will be updated soon!"