DogInfo / app.py
Rjshri's picture
Update app.py
d86aa5a
raw
history blame
17.9 kB
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 "If 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. Protein should come from high-quality animal sources to maximize digestibility and to provide the essential amino acids your dog needs. Moderate-to-high fat content, Nnutritious and digestible carbohydrates, Whole grains, starchy vegetables, and fresh fruits."
elif breed == 'Basset Hound':
return "Basset Hounds are prone to obesity so select a dog food that is formulated to meet their specific energy requirements without overloading them with excessive calories. Basset Hounds are susceptible to joint problems, including hip dysplasia and arthritis, so the food you choose should contain ingredients like glucosamine and chondroitin. This dog breed may also be prone to digestive issues, including bloating and gas so choose a dog food that contains easily digestible ingredients, such as high-quality proteins and fibers."
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 listed as the first ingredient. Dog foods with a good source of animal-based protein, is crucial for a Bernedoodle’s active lifestyle. Look for foods with moderate levels of healthy fats, such as omega-3 and omega-6 fatty acids. Depending 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."
elif breed == 'Bichon Frise':
return "This breed is prone to allergies so, when choosing a dog food look for recipes with limited, wholesome ingredients and novel protein such as fish, venison, duck or rabbit. Bichons, like many small breeds, are prone to urolithiasis, stones in the urinary tract, so keeping your dog well-hydrated is important to help prevent and control it – make sure your dog has access to bowls of fresh water."
elif breed == 'Boston Terrier':
return "Boston Terriers are prone to joint problems including patella luxation, so choose a food which contains ingredients such as glucosamine and chondroitin which can help support joint health and mobility. Opt 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. Boston Terriers may have food sensitivities or allergies, so be mindful of potential allergens in their food."
elif breed == 'Boxer':
return "Boxers are an active breed and require a diet with a good source of protein. Look for dog foods with real meat as the first ingredient, such as chicken, beef, or fish. Avoid products that rely heavily on plant-based proteins. Boxers can be prone to weight gain, so consider a formula that supports a healthy weight. While some Boxers may do well on grain-free diets, others may experience heart issues due to a lack of taurine."
elif breed == 'Boykin Spaniel':
return "Boykin Spaniels are active dogs, so it’s important to select a dog food that is formulated to meet their specific energy requirements without overloading them with excessive calories. As always, ensure that the dog food you choose provides a balanced mix of proteins, fats, carbohydrates, vitamins, and minerals. Opt for a dog food that lists high-quality animal-based proteins as the main ingredients, such as chicken, beef, or fish. These proteins provide essential amino acids for muscle development and maintenance."
elif breed == 'Cairn Terrier':
return "To avoid your Cairn Terrier gaining weight, it’s important to control their calorie intake. Opt for a dog food that is formulated to meet the energy needs of a moderately active dog, and be mindful of portion sizes. Look for dog food that includes sources of omega-3 fatty acids, such as fish oil or flaxseed. These fatty acids can promote healthy skin, a shiny coat, and support overall well-being."
elif breed == 'Cane Corso':
return "Cane Corsos are high-energy dogs, however due to their size, they do not zoom around as much as other working breeds so can be prone to obesity. Choose a dog food that is formulated specifically for large breed dogs but practice portion control to ensure you do not overload them with excessive calories. Aim for a dog food that contains around 25-30% protein content, moderate fat content of around 10-15% and whole grains or vegetables as a carbohydrate source."
elif breed == 'Catahoula Leopards':
return "Catahoula Leopards benefit from foods made specifically for medium-large breeds with high protein levels for energy and added taurine and vitamin A to protect eye health and vision. A diet rich in high-quality animal protein sources such as chicken, beef, or fish, is vital so look for a dog food with named meat protein sources at the top of the ingredient list. As with many larger breeds, Catahoula Leopards are prone to skeletal issues such as hip dysplasia. It is, therefore, crucial to choose a dog food that has appropriate and balanced levels of calcium and phosphorus to support healthy bone growth."
elif breed == 'Chihuahua':
return "Chihuahua puppies, adults and seniors each have different nutritional needs for optimal long-term health. Which means, A dog food designed for an adult chihuahua may contain too little calcium for a growing puppy or too many calories for a less active senior. And there are other significant differences like chihuahua puppy needs 1.0% arginine (an essential amino acid while an adult requires less, just 0.51% of the same nutrient. In comparison, A senior Chihuahua benefits from more protein and fewer calories. "
elif breed == 'Corgi':
return " When choosing a dog food for your Corgi, look for one which contains real animal-based protein sources as the main ingredients. Choose a kibble that is appropriate for their mouth size as this helps with chewing and digestion. Control the calorie intake and be mindful of portion sizes, include food with glucosamine and chondroitin. Select a dog food that is easily digestible and contains omega-3 fatty acids, such as fish oil or flaxseed."
elif breed == 'Dachshund':
return "Dachshund puppies, adults and seniors each have different nutritional needs. A dog food designed for an adult may contain too little calcium for a growing dachshund puppy or too little protein and too many calories for a less active senior. A growing dachshund puppy needs 0.71% isoleucine (one of 12 essential amino acids) while an adult requires just 0.38% of the same nutrient. The health of a senior dachshund can be enhanced by a dog food that contains 50% more protein than a younger animal."
elif breed == 'Doberman Pinscher':
return "Doberman Pinschers are muscular dogs but prone to genetic health issues such as hip dysplasia. So the food you choose should contain ingredients like glucosamine and chondroitin. 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. Opt for a dog food that lists high-quality animal-based proteins as the main ingredients, such as chicken, turkey, or fish."
elif breed == 'French Bulldog':
return "Look for dog foods with a high-quality source of protein as the main ingredient, such as chicken, beef, or fish. Avoid dog foods that contain excessive fillers like corn, soy, and wheat. French Bulldogs are prone to obesity, so choose dog food with a moderate fat content to help manage their weight. Look for dog food with added omega-3 fatty acids, which can help maintain healthy skin and a shiny coat, as well as support joint health. Choose a dog food with small kibble size to prevent choking and make eating easier."
elif breed == 'German Shepherd':
return "Look for dog foods with real meat as the primary ingredient, such as chicken, beef, or fish. This breed is prone to hip and joint issues, so a dog food with added glucosamine and chondroitin can help support their joint health. Look for dog foods that contain omega-3 fatty acids, such as those found in fish oil. Avoid dog foods that contain excessive fillers like corn, soy, and wheat. German Shepherds have different nutritional needs as puppies, adults, and seniors. Choose a dog food tailored to your dog's life stage."
elif breed == 'Golden Retriever':
return "When choosing food for your golden retriever, it’s super important to consider your dog’s age. Even though adult goldens benefit from eating better quality brands, choosing the right food for your puppy can be absolutely critical. Golden retriever puppies have a greater risk of developing a crippling form of hip disease, if they’re fed a diet that contains too much calcium. They must eat a food that’s specifically designed to be safe for large breed puppies. To keep the risk of diet-related hip disease low, avoid switching to an adult recipe too soon."
elif breed == 'Goldendoodle':
return "Goldendoodle puppies, adults and seniors each have different nutritional needs. Puppies have an increased risk of developing a crippling and permanent form of hip disease if they’re fed a diet that contains too much calcium while they’re still growing. Older goldendoodles require more protein and fewer calories than younger animals."
elif breed == 'Havanese':
return "Havanese can be prone to becoming overweight, so select a dog food that is formulated to meet their specific energy requirements without overloading them with excessive calories. They are susceptible to joint problems, including legg-calve-perthes disease and patella luxation, so the food you choose should contain ingredients like glucosamine and chondroitin. Opt for a dog food that lists high-quality animal-based proteins as the main ingredients, such as chicken, turkey, or fish."
elif breed == 'Jack Russels':
return "Consider your Jack Russell’s life stage—whether it’s a puppy, adult, or senior dog—and select a food formulated specifically for that age. Jack Russell Terriers are energetic, and active dogs, so a diet rich in high-quality proteins is important. Look for dog foods that list animal-based proteins (such as chicken, turkey, or fish) as the main ingredients. Avoid products that rely heavily on plant-based protein sources. Look for recipes that include sources of beneficial fats such as omega-3 fatty acids (found in fish oil or flaxseed) to promote a healthy coat and support overall well-being."
elif breed == 'Labradoodle':
return "Look for a dog food that contains high-quality protein sources as the main ingredient, such as chicken, beef, or fish. Labradoodles can be prone to digestive issues, so opt for a dog food that is easily digestible. Look for formulas that contain high-quality sources of carbohydrates, such as sweet potatoes or brown rice, and dietary fibers for optimal digestion. Labradoodles often have wavy or curly coats so choosing a dog food that includes omega-3 fatty acids, such as fish oil or flaxseed, can support their coat health and skin condition."
elif breed == 'Labrador Retrievers':
return "Finding the best food for your Lab’s age is far more important than it is for most other dogs. That’s because Labs are large breed dogs, which is not a concern for adult Labs.However, unlike adults, Lab puppies have an increased risk of developing a crippling and permanent form of hip disease if they’re fed a diet that contains too much calcium for their larger breed size."
elif breed == 'Maltese':
return "Maltese dogs need a balanced diet with an adequate amount of protein, usually around 18-30% protein content. Ensure the protein source is of good quality, as this will help maintain their lean muscle mass and overall health.A moderate amount of healthy fats (around 8-20%) is essential for Maltese dogs to support their energy levels and maintain their skin and coat health.Maltese dogs are small and can gain weight quickly, so portion control is crucial."
elif breed == 'Miniature Schnauzer':
return "Smaller kibble size and provide the right balance of nutrients tailored to their needs. As ever, look for a dog food that lists high-quality animal-based proteins, such as chicken, turkey, or fish, as the main ingredients. Miniature Schnauzers can be prone to weight gain, so select a dog food that helps them maintain a healthy body weight. Miniature Schnauzers can also suffer from dental issues, so opt for a dog food that supports dental health. Look for a dog food that contains ingredients such as omega-3 fatty acids to support healthy skin and a shiny coat."
elif breed == 'Pitbull':
return "Pitbulls are active dogs that require a diet with a significant protein content. Look for dog foods with at least 20-30% protein, with high-quality sources like chicken, beef, or fish listed as the first ingredient. Moderate amount of healthy fats (around 10-20%) is important to provide energy and support skin and coat health. Avoid dog food uses more of fillers such as corn, wheat, and soy, which provide little nutritional value."
elif breed == 'Pomeranian':
return "Look for dog food with real meat (e.g., chicken, turkey, lamb) listed as the first ingredient. Pomeranians need a moderate amount of healthy fats for energy and a shiny coat. Look for sources like chicken fat or fish oil. Pomeranians have small mouths, so if you are opting for a dry food choose small-sized kibbles that are easier for them to chew and digest."
elif breed == 'Rottweiler':
return "This large breed benefits from a diet rich in high-quality animal protein sources such as chicken, beef, or fish, so look for a dog food with named meat protein sources at the top of the ingredient list. Healthy fats are also crucial for Rottweilers to maintain optimal skin and coat health. Opt for dog foods that contain sources of omega-3 and omega-6 fatty acids such as fish oil, flaxseed, or chicken fat. You should also avoid dog foods that contain artificial colors, flavors, or preservatives and opt for natural and minimally processed options."
elif breed == 'Shiba Inu':
return "When choosing a dog food for your Shiba Inu, look for one which contains real animal-based protein sources as the main ingredients. Chicken, beef, fish, or lamb are excellent protein options. Shiba Inus are a small to medium-sized breed, so select a dog food with kibble that is appropriate for their mouth size. Look for dog food that includes sources of omega-3 fatty acids, such as fish oil or flaxseed."
elif breed == 'Siberian Husky':
return "The nutritional requirement depends on the age of your particular husky. Adult huskies can do well on just about any top-rated, nutrient-balanced dog food. However, Husky puppies have a slightly higher (2.2%) risk1 of developing a crippling and permanent form of hip disease a risk which may increase if they’re fed a diet that contains too much calcium (while they’re still growing). Senior huskies need more protein and fewer calories than younger animals."
elif breed == 'Weimaraners':
return "Weimaraner dogs are prone to skeletal issues such as hip dysplasia, it’s, therefore, crucial to choose a dog food that has appropriate and balanced levels of calcium and phosphorus to support healthy bone growth. Look for recipes which contain glucosamine and chondroitin. It’s also important not to exercise your dog an hour either before or after meals. A Weimaraner’s diet should be formulated for a large-sized breed with high energy and exercise needs."
elif breed == 'Vizsla':
return "Vizslas are prone to skeletal issues such as hip dysplasia so look for recipes which contain glucosamine and chondroitin. Healthy fats 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. They benefit from a diet rich in high-quality animal protein sources such as chicken, beef, or fish, so look for a dog food with named meat protein sources at the top of the ingredient list."
elif breed == 'Yorkie':
return "The best food for a Yorkie is based on the age and life stage of the dog. A dog food designed for an adult Yorkie may contain too little calcium for a growing puppy or too little protein and too many calories for a less active older dog. A Yorkie puppy needs 1.29% leucine (one of 12 essential amino acids) while an adult requires just 0.68% of the exact same nutrient. In comparison, A senior Yorkie benefits from a dog food that contains more protein and fewer calories per serving."
else:
return "Nutritional info currently not available for your breed. Will be updated soon!"