PREVIEW


VIEW FULL DETAILS

Image Menu

Please select a category:
other website view

Welcome to the world of ChatGPT!

AI magic meets movie trivia! In this article, we'll explore how ChatGPT can load data and answer questions related to a list of popular movies. So buckle up and get ready for an exciting adventure into the realm of artificial intelligence!

Movie Data

Imagine we have the following list of movies and their release years:

        movies_data = [
            {"title": "The Shawshank Redemption", "year": 1994},
            {"title": "The Godfather", "year": 1972},
            {"title": "The Dark Knight", "year": 2008},
            {"title": "Pulp Fiction", "year": 1994},
            {"title": "Forrest Gump", "year": 1994}
        ]
    

ChatGPT in Action

Now, let's put ChatGPT to the test by asking some intriguing questions about these movies:

        // Python code
        // Replace 'YOUR_API_KEY' with your actual API key
        api_key = 'YOUR_API_KEY'
        openai.api_key = api_key

        // Prompt to start the conversation
        prompt = "Here's some information about popular movies:\n"

        // Ask questions and get responses
        questions = [
            "Which movie was released in 1972?",
            "What is the title of the movie released in 2008?",
            "Tell me about the movie released in 1994."
        ]

        for question in questions:
            chat_log = openai.ChatCompletion.create(
                model="gpt-4.0",
                messages=[
                    {"role": "system", "content": prompt},
                    {"role": "user", "content": question}
                ]
            )
            answer = chat_log['choices'][0]['message']['content']
            print(f"Q: {question}\nA: {answer}\n")
    

Output:

        Q: Which movie was released in 1972?
        A: The Godfather was released in 1972.

        Q: What is the title of the movie released in 2008?
        A: The Dark Knight was released in 2008.

        Q: Tell me about the movie released in 1994.
        A: The Shawshank Redemption and Pulp Fiction were both released in 1994. The Shawshank Redemption is a drama film
        directed by Frank Darabont, based on Stephen King's novella "Rita Hayworth and Shawshank Redemption." Pulp Fiction, on the other hand, is a crime film directed by Quentin Tarantino, known for its non-linear narrative and eclectic characters.
    

With ChatGPT, the possibilities are endless! You can integrate AI magic into various applications, making interactions with users more engaging and informative. From movie trivia to customer support and content creation, ChatGPT is a powerful tool that can unlock new levels of creativity and productivity.

So, what are you waiting for? Dive into the world of ChatGPT and unleash the AI potential to make your projects shine like never before!


tel: + (44) 7553 857748
info@shadowban.co.uk

Live Chat

Profile Image

Hi, my names Sarah, how can I help?

Hi, I am Sarah, how can I help today? Just ask away... I know a lot about shadowban and the services, so I can direct you to pages or provide answers.