Smart Multilingual Translator Using PictoBlox and ChatGPT AI
by rohinivijaya in Circuits > Robots
10 Views, 0 Favorites, 0 Comments
Smart Multilingual Translator Using PictoBlox and ChatGPT AI
The Smart AI Translator is an AI-powered project built using PictoBlox, ChatGPT, Text-to-Speech, and Animated Text extensions. It allows users to translate text between different languages, display the translated output on the screen, and hear it spoken aloud. This project demonstrates how Artificial Intelligence can make multilingual communication simple, interactive, and accessible for everyone.
Supplies
Tools required to create this project are:
- Pictoblox Software: Download PictoBlox | Windows, MacOS, Linux, Chromebook, Android & iOS
- Laptop/PC
Open the PictoBlox Software & Choose Blocks Coding Environment.
Launch the PictoBlox software on your computer and create a new project. From the coding environment options, select Blocks Mode, which provides a visual drag-and-drop interface for building the Smart Multilingual Translator without writing code. This mode makes it easy to add sprites, extensions, variables, and AI functionalities to the project.
Add Extensions
1. ChatGPT Extension
The ChatGPT extension provides AI-powered translation capabilities.
2. Text to Speech Extension
The Text-to-Speech extension converts translated text into spoken audio.
3. Animated Text Extension
The Animated Text extension displays text attractively on the stage.
Add and Arrange the Sprites
PictoBlox already includes the Tobi sprite by default, so it can be used as the main controller sprite for this project. Since Tobi is only used to manage the code and translation process, you may hide it when the project starts.
Next, create language button sprites for all the languages used in the translator, such as Hindi, Malayalam, English, French, Spanish, and Tamil. Rename each sprite according to its language. Then duplicate each language button to create two versions:
- One button for selecting the From Language.
- One button for selecting the To Language.
Finally, add two Animated Text sprites using the Animated Text extension:
- Input Text Display – Shows the text entered by the user.
- Output Text Display – Shows the translated result generated by ChatGPT.
Arrange the language buttons neatly on the stage and place the Input and Output Text displays where the user can easily view the translation process.
Create Variables
Create the following variables for the project:
- Text Language – Stores the source language selected by the user.
- Translation Language – Stores the target language selected for translation.
- Question – Stores the text entered by the user for translation.
- Answer – Stores the translated output generated by ChatGPT.
Add a Welcome Message
When the Green Flag is clicked, the project welcomes the user and provides instructions.
Select the Source Language
Choose language selection buttons or sprites.
When the user clicks a language button, it becomes the source language.
When the user clicks a From Language button (such as Hindi, English, Malayalam, French, Spanish, or Tamil), the project stores the selected language in the Text Language variable.
The button briefly changes its appearance to indicate that it has been selected, and Tobi announces the chosen source language using Text-to-Speech.
For example, if the user clicks From Hindi, the variable Text Language is set to Hindi.
This language will be used as the language of the text entered by the user.
Select the Translation Language
Choose language selection buttons or sprites.
When a To Language button is clicked:
- The selected language is stored in the Translation Language variable.
- A voice confirmation is provided.
- The project broadcasts message1 to start the translation process.
Why is message1 used?
The broadcast message1 acts as a trigger that tells the rest of the project that both languages have been selected and the user can now enter the text for translation.
Using broadcasts makes the project more organized because different sprites can communicate with each other without directly running each other's code.
Ask the User for Text
When Tobi receives message1, it asks the user to enter the text that needs to be translated.
The user types the sentence or word into the input box.
The entered text is stored in the Question variable.
At the same time, the Input Animated Text sprite receives the broadcast and displays the entered text on the screen so the user can verify what was typed.
Translate the Text Using ChatGPT
After the user enters the text, Tobi sends a prompt to ChatGPT asking it to translate the text from the selected source language to the selected target language.
The prompt contains:
- The source language
- The target language
- The user's text
ChatGPT processes the request and returns the translated result.
The translated output is stored in the Answer variable.
Example:
Source Language: English
Target Language: Malayalam
Input: Good Morning
Output: സുപ്രഭാതം
Broadcast Translate
The Input Animated Text sprite displays the content stored in the Question variable.
The Output Animated Text sprite displays the content stored in the Answer variable after receiving the Translate broadcast.
This gives users a clear view of:
- The original text entered.
- The translated text generated by ChatGPT.
The translation appears instantly on the stage, creating a clean and user-friendly interface.
Final Code
Results
Example 1
- From Language: Hindi
- To Language: English
- Input Text: नमस्ते, आप कैसे हैं?
- Translated Output: Hello, how are you?
Example 2
- From Language: English
- To Language: Malayalam
- Input Text: Good Morning
- Translated Output: സുപ്രഭാതം
Example 3
- From Language: English
- To Language: French
- Input Text: Thank You
- Translated Output: Merci
Example 4
- From Language: English
- To Language: Spanish
- Input Text: How are you?
- Translated Output: ¿Cómo estás?
Future Enhancements
- Speech Recognition for voice input
- Real-time conversation translator
- OCR-based image translation
- Translation history storage
- Support for additional languages
- AI-powered grammar correction
- Offline translation capability
Conclusion
The Smart AI Translator is an engaging Artificial Intelligence project that combines the power of ChatGPT, Text-to-Speech, and Animated Text in PictoBlox. By allowing users to translate text between different languages, display the results visually, and hear them spoken aloud, this project demonstrates a practical real-world application of AI. It serves as an excellent learning project for students interested in Artificial Intelligence, Natural Language Processing, and multilingual communication systems.