Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1002 Bytes

20240702100735.md

File metadata and controls

44 lines (35 loc) · 1002 Bytes

Image classification with Marvin AI

Another cool thing you can do with Marvin AI is classifying images. 💡 💪

I just gave it my profile picture and asked what type of programmer I am and what I am holding in my hands. 🐍🪄

See below - it did a great job! 😍 📈

import marvin

img = marvin.Image(
    "https://pbs.twimg.com/profile_images/1365563799571431428/wj7Hu5-6_400x400.jpg"
)

programer = marvin.classify(
    img,
    labels=["Rustacean", "Pythonista", "Javaist", "Rubyist", "Gopher", "Haskellites"],
)

object_in_hands = marvin.classify(
    img,
    labels=[
        "stick",
        "tool",
        "flag",
        "banner",
        "staff",
        "book",
        "smartphone",
        "bottle",
        "pen",
        "notebook",
        "other",
    ],
    instructions="What object is the programmer holding?",
)

print(f"Programmer is a {programer} and is holding a {object_in_hands}")
# Outputs:
# Programmer is a Pythonista and is holding a staff

#marvinai