Table of Contents

input()

Function Definition: input(question = "What is your name")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
questionstringThe question you want to ask.String"What is your name"

Description

The function will make an input box (with the specified text above it) show at the bottom of the screen. Users can input text into it and submit it, and the input is stored then in the Answer. The Answer automatic updates to the most recent input.

Example

The example demonstrates how to use a repeat block to recite a table in PictoBlox.

Code

sprite = Sprite('Tobi')

sprite.input("Which table you want to recite")
number = int(sprite.answer())

for i in range(1, 10):
  sprite.say(str(number) + " x " + str(i) + " = " + str(number*i), 1)

Output

Read More
Discover an interactive way to get word definitions using ChatGPT and text-to-speech. Prompt users to choose a definition, generate it with ChatGPT, and have the sprite speak it out using the text-to-speech extension.

Introduction

We ask the user which definition they want, and based on their input, ChatGPT generates the definition of the particular word. The sprite then uses the text-to-speech extension to speak out the definition.

Logic

The code represents a conversation between the sprite character “Tobi” and the AI models. The sprite asks the user for a definition, the user responds, the AI generates a result based on the response, and the sprite says and speaks the result.

Follow the steps below:

  1. Open PictoBlox and create a new file.
  2. Choose a suitable coding environment for python-based coding.
  3. Add the text-to-speech and ChatGPT extensions to your project from the extension palette located at the bottom right corner of PictoBlox.
  4. We create an click on of the Text to Speech extension. This class allows us to convert text into spoken audio.
  5. Next, we create an click on of the ChatGPT extension. ChatGPT is a language model that can generate human-like text responses based on the input it receives.
  6. Define a sprite Tobi.
  7. Create an instance of the ChatGPT AI model. ChatGPT is likely a class or module designed for generating responses to user inputs or questions.
  8. Furthermore, we create an instance of the TexttoSpeech model using  TexttoSpeech(). It seems to be a text-to-speech synthesis system, allowing the AI to convert generated text into spoken words.
  9. The sprite will prompt the user to provide a specific definition.
  10. The user’s response to the sprite’s question is stored in the variable “l” after converting it to a string using the str() function.
  11. Then calls a method named askdefinition() on the gpt object, passing the user’s input l as an argument. It seems that this method is responsible for retrieving a definition based on the user’s input.
  12. Furthermore, calls a method named chatGPTresult() on the gpt object, which likely generates a response or result based on the provided definition. The result is stored in the variable result.
  13. Now, we instruct the sprite Tobi to show the result byusing the say() method.
  14. Finally we call the speak() method on the speech object, passing the result as an argument. This is likely responsible for synthesizing the text into speech and playing it back.
  15. Press the Run button to run the code.

Code

sprite = Sprite('Tobi')
gpt = ChatGPT()
speech = TexttoSpeech()

sprite.input("Which definition do you want?")
l = str(sprite.answer())

data=gpt.askdefination(l)

result=gpt.chatGPTresult()
sprite.say(result,10)
speech.speak(result)

Output

Read More
The Language Translator with ChatGPT is a powerful system that enables real-time translation and conversation support, facilitating multilingual communication.

Introduction

The Language Translator with ChatGPT and Speech Recognition is a system that helps people communicate across languages by providing real-time translation and conversation support. It combines language translation, chatbot capabilities, and speech recognition to facilitate multilingual communication.

Language Translator Using ChatGPT is a project that trains the ChatGPT language model with multilingual data to enable it to understand and translate text between different languages. It utilizes ChatGPT’s natural language processing abilities to generate human-like responses, making it ideal for building a language translation system. The training data includes sentence pairs in different languages and their corresponding translations.

Logic

The code represents a conversation between the sprite character “Tobi” and the AI models. The sprite asks the user for a definition, the user responds, the AI generates a result based on the response, and the sprite says and speaks the result.

Follow the steps below:

  1. Open PictoBlox and create a new file.
  2. Choose a suitable coding environment for block-based coding.
  3. Add the extensions to your project from the extension palette located at the bottom right corner of PictoBlox.
  4. We create an instance of the Text to Speech class called speech. This class allows us to convert text into spoken audio.
  5. Next, we create an instance of the ChatGPT model called gpt. ChatGPT is a language model that can generate human-like text responses based on the input it receives. 
  6. The sprite asks the user to provide a sentence by using the input() function and stores the input in the variable ‘l‘.
  7. The translatelanguage() method of the ‘gpt‘ object is then used to translate the sentence stored in ‘l’ into Hindi. The translated sentence is stored in the variable ‘result‘.
  8. The sprite uses the say() method say() to speak out the translated sentence stored in ‘result’.
  9. The speak() method of the speech() object is called to convert the translated sentence into audio and play it.

Code

sprite = Sprite('Tobi')
gpt = ChatGPT()
speech = TexttoSpeech()

sprite.input("Provide a Sentece i will traslated into Hindi ")
l = str(sprite.answer())

gpt.translatelanguage(l,"hindi")
result=gpt.chatGPTresult()

sprite.say(result,2)
speech.speak(result)

Output

Read More
Convert any word or phrase into a delightful sequence of emojis with our Emoji Converter.

Introduction

Are you looking to add some fun and expressiveness to your conversations? Look no further! I’m here to help you convert any word or phrase into a colorful array of emojis. Whether you want to spice up your messages, or social media posts, or simply bring a smile to someone’s face, I’ve got you covered.

Just type in the word or phrase you want to transform, and I’ll generate a delightful sequence of emojis that capture the essence of your text. Emojis are a universal language that transcends words from happy faces to animals, objects, and everything in between.

So, let’s get started and infuse your text with a touch of emoji magic! 🎉🔥

Logic

This code allows the user to interact with the sprite and provide emojis, which are then transformed into a response using the ChatGPT model. The sprite then speaks the generated response using the provided emojis.

  1. Open PictoBlox and create a new file.
  2. Choose a suitable coding environment for python-based coding.
  3. Define a sprite , Tobi.
  4. Then, we create an instance of the ChatGPT model using the ChatGPT class.
  5. The sprite asks the user to input the emojis they want to use by calling the input method.
  6. The sprite uses its answer method to get the user’s response, which is then converted to a string using str().
  7. The movieToemoji method of the ChatGPT model converts the user’s response into emojis.
  8. The chatGPTresult method retrieves the result of the ChatGPT conversation.
  9. Finally, the sprite says the result for 5 seconds using the said method.

Code

sprite = Sprite('Tobi')
gpt = ChatGPT()

sprite.input("Please let me know which emojis you'd like me to use by typing them here.")
answer= str(sprite.answer())

gpt.movieToemoji(answer)
result=gpt.chatGPTresult()

sprite.say(result,5)

Output

Read More
Convert any word or phrase into a delightful sequence of emojis with our Emoji Converter.

Introduction

Are you looking to add some fun and expressiveness to your conversations? Look no further! I’m here to help you convert any word or phrase into a colorful array of emojis. Whether you want to spice up your messages, or social media posts, or simply bring a smile to someone’s face, I’ve got you covered.

Just type in the word or phrase you want to transform, and I’ll generate a delightful sequence of emojis that capture the essence of your text. Emojis are a universal language that transcends words from happy faces to animals, objects, and everything in between.

So, let’s get started and infuse your text with a touch of emoji magic! 🎉🔥

Logic

This code allows the user to interact with the sprite and provide emojis, which are then transformed into a response using the ChatGPT model. The sprite then speaks the generated response using the provided emojis.

  1. Open PictoBlox and create a new file.
  2. Choose a suitable coding environment for Block-based coding.
  3. Define a sprite , Tobi.
  4. Then, we create an instance of the ChatGPT model using the ChatGPT class.
  5. The sprite, named Tobi, asks for a world that can be converted into emojis by using the command sprite.input(“Please provide a world that I can convert into emojis”).
  6. After receiving the input, Tobi uses the answer() function to generate a response based on the provided world.
  7. Next, the language model, ChatGPT, is involved. It has a function called movieToemoji() that takes the generated response from Tobi and performs some operation related to converting a movie into emojis.
  8. Finally, the result of the operation performed by ChatGPT is stored in the variable result. Tobi then uses the command sprite.say(result, 5) to display the result for 5 seconds.
  9. In summary, the code represents a scenario where Tobi the sprite asks for a world, ChatGPT processes the input and performs some operation related to movies and emojis, and Tobi displays the result.

Code

sprite = Sprite('Tobi')
gpt = ChatGPT()


sprite.input("Please provide a world that i can convert into an emojis")
answer=sprite.answer()

gpt.movieToemoji(answer)
result=gpt.chatGPTresult()
sprite.say(result,5)

Output

Read More
Welcome to the Noun Detector, a powerful tool that utilizes ChatGPT and the spaCy library to identify and extract nouns from text.

Introduction

Welcome to the Noun Detector! This powerful tool utilizes the capabilities of ChatGPT and leverages the spaCy library to identify and extract nouns from text. By employing advanced natural language processing techniques, the Noun Detector analyzes sentences and highlights the essential elements that represent people, places, objects, or concepts.

Noun Detector is designed to excel at identifying and extracting nouns from text. Experience the Noun Detector’s capabilities firsthand and unlock the power of noun extraction in your language-processing endeavors. Try it out and witness the precision and efficiency of this invaluable tool!

Code

sprite = Sprite('Tobi')

quarky=Quarky()
gpt = ChatGPT()

gpt.askOnChatGPT("AIAssistant", "Genrate simple random sentence for me")
result=gpt.chatGPTresult()
gpt.getgrammerfromtext("GrammerNoun",result)
noun=gpt.chatGPTresult()

sprite.say(result,5)
print(result)
print(noun)


sprite.input("Indentify and write the noun in sentance")
answer= str(sprite.answer())

if the answer in noun:
  sprite.say("You have a strong understanding of noun concepts. Well done!",5)
else:
  sprite.say("Please check the terminal for the correct answer as your response is incorrect",5)

Logic

  1. Open PictoBlox and create a new file.
  2. Choose a suitable coding environment for block-based coding.
  3. We have a sprite character named Tobi.
  4. Add the ChatGPT extensions to your project from the extension palette located at the bottom right corner of PictoBlox.
  5. We will ask the AI assistant to create a random sentence for us.
  6. The AI assistant will generate the sentence and identify the nouns in it.
  7. Tobi will then say the generated sentence out loud for 5 seconds. The sentence and the identified nouns will be displayed on the screen.
  8. Next, Tobi will ask you to identify and write the noun in the sentence. You need to type your answer.
  9. If your answer matches any of the identified nouns, Tobi will appreciate you.
  10. But if your answer is incorrect, Tobi will say to check the terminal.
  11. So, give it a try and see if you can identify the noun correctly!

Output

Read More
Expand your vocabulary and enhance your writing with the Synonyms and Antonyms Word Converter.

Introduction

The Synonyms and Antonyms Word Converter is a powerful tool powered by the ChatGPT extension that allows users to effortlessly find synonyms and antonyms for words. It harnesses the capabilities of the advanced language model to provide accurate and contextually relevant word alternatives.

With the Synonyms and Antonyms Word Converter, you can expand your vocabulary, enhance your writing, and improve your communication skills. Whether you’re a writer seeking more expressive language or a student looking to diversify your word choices, this tool is designed to assist you in finding suitable alternatives quickly and easily.

Using the ChatGPT extension, the Synonyms and Antonyms Word Converter engage in interactive conversations, making it an intuitive and user-friendly tool. By providing a word as input, you can receive a list of synonyms or antonyms, depending on your preference, helping you to diversify your language and convey your ideas with precision.

Code

sprite = Sprite('Tobi')
gpt = ChatGPT()
str2 = ""
var2=""

sprite.input("Please provide a word for which you would like to find synonyms and antonyms")
answer= str(sprite.answer())

gpt.getsynonymsAntonymsfromText("Synonyms",answer)
str1=gpt.chatGPTresult()


for i in str1:
    if not i.isdigit():
        str2 += i
        
print("Synonyms words are:", str2)

gpt.getsynonymsAntonymsfromText("Antonyms",answer)
var1=gpt.chatGPTresult()

for j in var1:
    if not j.isdigit():
        var2 += j
        
print("Antonyms words are:", var2)

Logic

  1. Open PictoBlox and select the environment as appropriate Python Coding Environment.
  2. Create a new file.
  3. Select the environment as appropriate Python Coding Environment.
  4. First, an instance of the Sprite class is created, with the name “Tobi”.
  5. To add the ChatGPT extension, click on the extension button located as shown in the image. This will enable the ChatGPT extension, allowing you to incorporate its capabilities into your project.
  6. Two empty strings, str2 and var2, are declared to store the resulting synonyms and antonyms, respectively.
  7. The user is prompted to provide a word for which they want to find synonyms and antonyms using the input() method from the Sprite library.
  8. The user’s input is stored in the answer variable as a string.
  9. The getsynonymsAntonymsfromText() method is called on the gpt object to find synonyms for the provided word. The category “Synonyms” is specified.
  10. The resulting synonyms are obtained from gpt.chatGPTresult() and stored in the str1 variable.
  11. The code then iterates over each character in str1 and appends non-digit characters to str2, filtering out any numerical values.
  12. Finally, the code prints the extracted synonyms stored in str2.
  13. The process is repeated for finding antonyms, where the getsynonymsAntonymsfromText() method is called with the category “Antonyms“, and the resulting antonyms are stored in the var1 variable.
  14. Non-digit characters are extracted and stored in var2, which contains the antonyms.
  15. The code concludes by printing the extracted antonyms stored in var2.
  16. Press Run to run the code.
  17. Sprite Tobi asks for the word you want synonyms/antonyms for.
  18. Go to the terminal. the terminal will display the synonyms and antonyms for a word.

Output

Read More
Engage in interactive conversations with the AI assistant powered by ChatGPT and Sprite Tobi.

Introduction

The Chatbox with ChatGPT Extension is a versatile tool that enables developers to integrate AI-driven conversations into their applications. It leverages the power of the ChatGPT model to create interactive and intelligent chat experiences. With this extension, you can build chatbots, virtual assistants, or conversational agents that understand and respond to user inputs naturally.

The code creates a character named “Tobi” and uses speech recognition to understand spoken commands. It then asks a question to the AI assistant (ChatGPT) and displays the response on the screen, converts it into speech, and makes the character “Tobi” speak the response.

Code

sprite = Sprite('Tobi')
gpt = ChatGPT()

speech = TexttoSpeech()

sr = SpeechRecognition()
ts = TexttoSpeech()
sr.analysespeech(4, "en-US")
command = sr.speechresult()
answer = command.lower()

# sprite.input("Provide a valid word")
# answer= str(sprite.answer())


gpt.askOnChatGPT("AIAssistant", answer)
# Ask on chatGPT other OPTION "friendAI" "sarcasticAI"
result=gpt.chatGPTresult()
print(result)
speech.speak(result)

sprite.say(result,5)

Logic

  1. Open PictoBlox and create a new file.
  2. Choose a suitable coding environment for Block-based coding.
  3. We create an instance of  Speech recognition. This class allows us to convert spoken audio into text.
  4. Next, we create an instance of the ChatGPT model called gpt. ChatGPT is a language model that can generate human-like text responses based on the input it receives. 
  5. Recognize speech for 5 seconds using recognize speech for ()s in the () block.
  6. The sprite object has already been initialized.
  7. We analyze the spoken speech for 4 seconds and assume it is in the English language using analysespeech().
  8.  We store the recognized speech as text in the variable command using speechresult().
  9. We convert the recognized speech to lowercase and store it in the variable answer.
  10. We ask the AI model ChatGPT (acting as an AI assistant) a question based on the user’s input stored in the answer.
  11. We retrieve the response from the AI model and store it in the variable result using chatGPTresult().
  12. We display the response on the screen using print(result).
  13.  We convert the response into speech and play it aloud using the speech object using speak().
  14.  The character “Tobi” speaks the response for 5 seconds using say().
  15. Press the Run button to run the code.

Output

I asked ChatGPT for a joke, and it responded with an interesting response.

Read More
All articles loaded
No more articles to load