Using OpenAI’s API

I enrolled in this course in May, a time when access to OpenAI was limited and its commercial model was still under development. Hence, leveraging the API emerged as the most straightforward method to use the platform. Jose Portilla’s course on Udemy brilliantly introduces how to tap into the API, harnessing the prowess of OpenAI to craft intelligent Python-driven applications.

The influx of AI platforms and services last summer indicates that embedding AI models into developments has become a standard practice.

OpenAI’s API ranks among the most sophisticated artificial intelligence platforms today, offering a spectrum of capabilities, from natural language processing to computer vision. Using this API, developers can craft applications capable of understanding and interacting with human language, generating coherent text, performing sentiment analysis, and much more.

The course initiates with a rundown of the OpenAI API basics, including account and access key setup using Python. Following this, learners embark on ten diverse projects, which include:

  • NLP to SQL: Here, you construct a POC that enables individuals to engage with a cached database and fetch details without any SQL knowledge.
  • Exam Creator: This involves the automated generation of a multiple-choice quiz, complete with an answer sheet and scoring mechanism. The focus here is on honing prompt engineering skills to format text outputs efficiently.
  • Automatic Recipe Creator: Based on user-input ingredients, this tool recommends recipes, complemented with DALLE-2 generated imagery of the finished dish. This module particularly emphasizes understanding the various models as participants engage with the Completion API and Image API.
  • Automatic Blog Post Creator: This enlightening module teaches integration of the OpenAI API with a live webpage via GitHub Pages.
  • Sentiment Analysis Exercise: By sourcing posts from Reddit and employing the Completion API, students assess the sentiment of the content. Notably, many news platforms seem to block such practices, labeling them as “scraping.”
  • Auto Code Explainer: Though I now use Co-pilot daily, this module introduced me to the Codex model. It’s adept at crafting docstrings for Python functions, ensuring that every .py file returns with comprehensive docstrings.
  • Translation Project: This module skims news from foreign languages, providing a concise English summary. A notable observation is the current model’s propensity to translate only to English. Users must also ensure they’re not infringing on site restrictions.
  • Chat-bot Fine-tuning: This pivotal tutorial unveils how one can refine existing models using specific datasets, enhancing output quality. By focusing on reducing token counts, learners gain insight into training data pricing, model utility, and cost-effectiveness. The module also underscores the rapid evolution of available models, urging students to consult OpenAI’s official documentation for the most recent updates.
  • Text Embedding: This segment was a challenge, mainly due to the intricate processes of converting text to N-dimensional vectors and understanding cosine similarity measurements. However, the module proficiently guides through concepts like search, clustering, and recommendations. It even delves into the amusing phenomenon of “model hallucination” and offers strategies to counteract it via prompt engineering.
  • General Overview & The Whisper API: Concluding the course, these tutorials provide a holistic understanding of the OpenAI API and its history, along with an introduction to the Whisper API, a tool adept at converting speech to text.

It’s noteworthy that most of the course material utilized the ChatGPT-3.5 model. However, recent updates have introduced a more efficient -turbo model. Additional information can be found here.

The course adopts a project-centric approach, with each segment potentially forming the cornerstone of a startup idea. Given the surge in AI startups, one wonders if this course inspired some of them.

This journey unraveled the intricate “magic” and “engineering” behind AI, emphasizing the importance of prompt formulation. Participants grasp essential elements like API authentication, making API calls, and processing results. By the course’s conclusion, you’re equipped to employ the OpenAI API to develop AI-integrated solutions. Prior Python knowledge can be advantageous.

Bill the Butcher scribble

Gangs of New York is a savage, bloody, and utterly unforgettable film that will transport you back to the lawless streets of 19th century New York. Leonardo DiCaprio gives a tour-de-force performance as Amsterdam Vallon, a young man who returns to the city to avenge the death of his father at the hands of Bill the Butcher (Daniel Day-Lewis), the ruthless leader of the Nativist gang. The film is awash in violence and depravity, but it is also a powerful and moving story about love, loss, and the struggle for power. If you’re looking for a film that will make you feel like you’re living in the middle of a Scorsese movie, then Gangs of New York is the one for you. One of my favourites.

More scribbles under “Art”

The Prophet and the Idiot

By Jonas Jonasson

The Prophet and the Idiot is a hilarious and heartwarming novel about three unlikely friends who embark on an adventure to make the most of their remaining time before the world ends. Jonas Jonasson, the author of the international bestseller The Hundred Year-Old Man Who Climbed Out of the Window and Disappeared, once again delivers a delightful and thought-provoking story that will leave readers smiling and feeling good.

The novel follows Petra, a self-taught astrophysicist who has calculated that the atmosphere will collapse on September 21, 2011, bringing about the end of the world. Armed with this terrible knowledge, Petra sets out to find Johan, a domesday prophet who she believes can help her spread the word and prepare for the apocalypse. Along the way, they meet Agnes, a widow of 75 who has made her living portraying a double life on social media as a young influencer. Together, the trio race through Europe as they plan to make the most of the time they have left, in more ways than one.

Jonasson’s characters are well-developed and relatable, and their interactions are often laugh-out-loud funny. The interactions with Barak Obama and Ban Ki-moon are genius and left me with an aching jaw from smiling. Johan is a particularly endearing character, with his kind heart and naiveté. He is always trying to do the right thing, even if it doesn’t always go according to plan. Petra is more cynical and pragmatic, but she is also fiercely independent and determined to make the most of her life. Agnes is the voice of reason in the group, but she is also quick to enjoy the moment.

The novel is full of unexpected twists and turns, and it will keep readers guessing until the very end. Jonasson also tackles some serious themes in the novel, such as the meaning of life and the importance of friendship. However, he does so in a way that is both humorous and thought-provoking.

The Prophet and the Idiot is a delightful and heartwarming novel that is sure to leave readers smiling and feeling good. It is a perfect read for anyone who enjoys a thought-provoking story and a good laugh.

Reasons I enjoyed this book:

  • The characters were well-developed and relatable. I found myself rooting for Johan, Petra, and Agnes throughout their journey.
  • The plot was engaging and unpredictable. I never knew what was going to happen next.
  • The humor was spot-on. I laughed out loud on several occasions.
  • The themes were thought-provoking. The novel made me think about the meaning of life and the importance of friendship.

Edinburgh Fringe 2023

It is that time of year again where Edinburgh grinds to a halt to make way for what is touted as the biggest arts festival in the world. I took the opportunity last weekend to sneak into the lull before it all kicked off this week and took some photos. It is a pain moving around and trying to do anything “normal” in Edinburgh during August but it is awesome how the city morphs into this behemoth arts beast. So much youth, talent and innocence on display.

Time for the robots

While running around the university yesterday I spotted a lone robot lawn mover doing its thing, see pics. I found the “operator” – an actual human – who took me through how they set an initial program and then just let it go. In this case it was mowing the awkward slopes in the Uni. He also told me about the pitch painting robot they have just got that uses GPS to paint perfect pitch lines.

It is happening all around us – the rise of AI and the machine age.

The old web is dying, & the new web struggles to be born

Dali plate of eye candy using Googles Deep Dream

The web is changing, and AI is playing a big role in that change. AI systems are capable of generating text and images in abundance, which could potentially overrun or outcompete the platforms we rely on for news, information, and entertainment. However, the quality of this machine-generated content is often poor, and it is built in a way that is parasitical on the web today.

Google is trying to kill the 10 blue links. Twitter is being abandoned to bots and blue ticks. There’s the junkification of Amazon and the enshittification of TikTok. Layoffs are gutting online media. A job posting looking for an “AI editor” expects “output of 200 to 250 articles per week.” ChatGPT is being used to generate whole spam sites. Etsy is flooded with “AI-generated junk.” Chatbots cite one another in a misinformation ouroboros. LinkedIn is using AI to stimulate tired users. Snapchat and Instagram hope bots will talk to you when your friends do not. Redditors are staging blackouts. Stack Overflow mods are on strike. The Internet Archive is fighting off data scrapers, and “AI is tearing Wikipedia apart.” The old web is dying, and the new web struggles to be born.

The problem, in extremely broad strokes, is this. Years ago, the web used to be a place where individuals made things. They made homepages, forums, and mailing lists, and a small bit of money with it. Then companies decided they could do things better. They created slick and feature-rich platforms and threw their doors open for anyone to join. They put boxes in front of us, and we filled those boxes with text and images, and people came to see the content of those boxes. The companies chased scale, because once enough people gather anywhere, there is usually a way to make money off them. But AI changes these assumptions.
Google Search underwrites the economy of the modern web, distributing attention and revenue for much of the internet. Google has been spurred into action by the popularity of Bing AI and ChatGPT as alternative search engines, and it’s experimenting with replacing its traditional 10 blue links with AI-generated summaries. But if the company goes ahead with this plan, then the changes would be seismic.

A writeup of Google’s AI search beta from Avram Piltch, editor-in-chief of tech site Tom’s Hardware, highlights some of the problems. Piltch says Google’s new system is essentially a “plagiarism engine.” Its AI-generated summaries often copy text from websites word-for-word but place this content above source links, starving them of traffic. It’s a change that Google has been pushing for a long time, but look at the screenshots in Piltch’s piece and you can see how the balance has shifted firmly in favour of excerpted content. If this new model of search becomes the norm, it could damage the entire web, writes Piltch. Revenue-strapped sites would likely be pushed out of business and Google itself would run out of human-generated content to repackage. 

AI dynamics — producing cheap content based on others’ work — that is underwriting this change, and if Google goes ahead with its current AI search experience, the effects would be difficult to predict. Potentially, it would damage whole swathes of the web that most of us find useful — from product reviews to recipe blogs, hobbyist homepages, news outlets, and wikis. Sites could protect themselves by locking down entry and charging for access, but this would also be a huge reordering of the web’s economy. In the end, Google might kill the ecosystem that created its value, or change it so irrevocably that its own existence is threatened. 

Google is also experimenting with AI-generated summaries for its search results. This could have a significant impact on the web, as it would favour sites that produce cheap content based on others’ work. This could damage whole swathes of the web that most of us find useful, such as product reviews, recipe blogs, and news outlets.

The evidence so far suggests it will degrade the quality of the web in general. As Piltch notes in his review, for all AI’s vaunted ability to recombine text, it is people who ultimately create the underlying data — whether that’s journalists picking up the phone and checking facts or Reddit users who have had exactly that battery issue with the new cordless ratchet and are happy to tell you how they fixed it. By contrast, the information produced by AI language models and chatbots is often incorrect. The tricky thing is that when it is wrong, it is wrong in ways that are difficult to spot. 

In the end, the future of the web is uncertain. It is possible that AI will lead to a degradation of the quality of information available online. However, it is also possible that AI will be used to create new and innovative forms of content. Only time will tell what the future holds.

Artful Parodies and Whimsical Dreams: The World of Grayson Perry

July is turning into a my culture month ahead of the festival landing – went to see the Grayson Perry retrospective at the National Galleries of Scotland, Edinburgh yesterday with my mommy.

Putting aside the terrible choice of venue, the National Galleries of Scotland is a beautiful and prestigious institution, but it is not necessarily the best place to show work that is as subversive and challenging as Perry’s. I think the Gallery of Modern Art would have been a more natural home for this exhibition.

In his retrospective at the National Galleries of Scotland (Royal Scottish Academy), Grayson Perry reveals a synthesis of his true self and aspirations. In his artwork, “Reclining Artist,” Perry presents a fantasy version of himself, embracing both masculine and feminine qualities. This 2017 vision is an authentic and captivating work, as he gazes seriously at the viewer, breaking away from his familiar blokey persona.

Perry’s undeniable talent in creating detailed images is apparent, yet some of his works suffer from clutter and symbolism overload. For instance, his childhood teddy bear, Alan Measles, seems to occupy an excessive presence in his art, losing some of its symbolic power over time. Nevertheless, Perry playfully portrays his attachment to Alan Measles, making it a self-aware parody rather than a monomania. Perry is not afraid to experiment and to push the boundaries of what we expect from art. He is constantly trying new things, and sometimes this results in works that are not entirely successful. But even when his work is flawed, it is always thought-provoking and engaging.

The exhibition’s theme revolves around Englishness, but Perry’s meditations on national identity lack the depth of George Orwell’s analyses. Despite this, his artwork, “Comfort Blanket,” humorously highlights some aspects of inclusive Englishness, which may resonate with Brexiteers too.

While Perry’s understanding of the English middle class is evident, some of his works lack passion and courage, leaning towards flippancy and satire. Despite his prolific career, he occasionally veers into the territory of whimsy and empty quotation. Nevertheless, Perry has become popular and beloved by sharing the English middle class’s ambivalence towards art, appealing to the national prejudice against those who take themselves too seriously.

In conclusion, Grayson Perry’s art embodies a blend of whimsy and satire, reflecting his exploration of ‘identity’ and Englishness. While some of his works may be perceived as lacking depth, they resonate with audiences who appreciate his humorous and self-conscious approach. As an artist, Perry’s journey continues to provoke thought and laughter, making him a distinctive figure in modern British art.

“It’s not like learning to play the violin, where you can be demonstrably talented at a young age. With art, you really need to find your own voice and that takes a while. Actually, it’s a marathon – and if you are eventually original, you’re lucky.”

Grayson Perry

the sun is shining

Another found post in the ‘drafts’ folder, from 2010 I think

what a scorcher. sea’s of red cover the capital. drunken boys and girls frolic on the meadows while drunken men and women argue on the promenade – ah the burgh in the sun x

was checking out a friend of a friends company website last night – http://www.cagoule.tv/ – who make movies, well shorts and music videos etc. some nice stuff.