The Samsung frame TV has a brilliant Art Mode, that I really enjoy, that adds to home decor and more importantly displays high-quality artwork. The 4K QLED transforms my wall making a dull hanging TV transform into a virtual gateway to hallowed art galleries and art pieces from the world.

Art on the Frame TV

The Frame allows customizable bezels – that comes with various frame styles and colors to match the home decor. The ability to set rotation of schedules amidst various collections makes it easy to consume a set of Painters or even educate yourself about various painters, art galleries with a Samsung Art store subscription.

Want to experience Dutch Baroque? How about a Vermeer with its mastery of light and shadow? Feel like some Saturday surrealism? Presto, you got a Dali gallery with its juxtaposition of unrelated elements. On days you dont feel the intensity of a Van Gogh, you can just project your own pictures on the Frame that sits flush against your wall.

One of the modes I was missing in the Art Store was the lack of any AI-generated art. Multimodal Generative Models enabled by DALL-E and Midjourney have made text-to-image generation and inspiring creativity near-seamless. I hear more and more of the growth AI-generated art and proliferation of Artists using AI to create interactive installations fueling a hungry Art market ready to pay exorbitant amounts for high-value NFTs and even auctioned off by traditional auctioneers like Christie’s.

AI-generated Art

Thanks to the Samsung TV SDK that helps developing applications for Samsung TVs that use Tizen, its easy enough to customize the Art store’s offerings extending it beyond the Art store. I wanted to use the AI to generate daily art based on the day’s news and let it create the images based on the prompt I specify. my fondness for Vermeer’s extended to the prompts like – “Generate an photrealistic image in the style of Vermeer consolidating the various items from the summary of the latest news from today. Optimize for a 50-inch TV display, 16:9 aspect ratio, Ultra-high resolution, Crisp details, Immersive viewing experience. At the bottom right of the image, print ‘generated by AI’ in black bold”

Requirements:

  • Samsung Frame TV with Art Mode enabled
  • Network connection to the TV
  • Uses the samsungtvws library to communicate with the TV ( awesome library that provides a comprehensive set of tools for interacting with Samsung Smart TVs, huge props to the developers it offers a ton of automation beyond the Art store usecase so check it out!)
  • Uses the openai library to generate images based on prompts
  • Uses the perplexity library to get text completion based on prompts

Generating the Summary of the Daily news

def get_prompt(summary_question: str) -> str:
    """Get the latest from perplexity.ai.

    Args:
        summary_question: The question to ask perplexity.ai.

    Returns:
        The summary of the latest news.
    """
    request_payload = {
        "model": "llama-3.1-sonar-huge-128k-online",
        "messages": [
            {"role": "system", "content": "Be precise and concise."},
            {"role": "user", "content": summary_question},
        ],
    }
    headers = {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": f"Bearer {PPX}",
    }

    response = requests.post("https://api.perplexity.ai/chat/completions", json=request_payload, headers=headers)
    response.raise_for_status()

    response_data = response.json()
    summary = response_data["choices"][0]["message"]["content"]
    return summary

Image Generation

def generate_image(prompt: str) -> Optional[Image.Image]:
    """Generates an image from a prompt using the DALL-E 3 model and saves it to a file."""
    client = OpenAI(api_key=OPENAI_API_KEY)
    response = client.images.generate(
        model='dall-e-3',
        prompt=prompt,
        quality='hd',
        n=1
    )
    image_url = response.data[0].url

    image_response = requests.get(image_url, stream=True)
    if image_response.status_code == 200:
        file_name = '_'.join(prompt.split(' ')[:2] + [datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")]) + '.png'
        image_path = os.path.join('images', file_name)
        os.makedirs('images', exist_ok=True)
        with open(image_path, 'wb') as file:
            image_response.raw.decode_content = True  # type: ignore
            shutil.copyfileobj(image_response.raw, file)
        #return imagepath and imagename
        return file_name,image_path
    
   
    else:
        return None

Code Repository

Full code here : https://github.com/vishwanath79/frame-ai-art

CNN meet CNN

Summary

The results required a tuning of the prompt over a few days and I’ve changed this now to more scientific and meditative imagery to spur creativity. The daily AI-generated new generation, while revealing interesting results, was a downer with how much war and conflict our world is experiencing. Our news cycles seem to be dominated by conflict and misery emphasizing the need for a massive reset to focus on reducing conflicts, environment damage, poverty and injustice. One can hope we gain the wisdom to focus on multiple interconnected issues across humanity crucial for overall global progress.