AI content Generation -News enhancer
- Initialize API keys and libraries (NewsAPI, OpenAI, pygame, etc.).
2.Define functions for speech recognition, extracting country and category from recognized text, retrieving news, generating enhanced news bullets from GPT-3.5 model, and creating the news ticker animation using Tkinter.
-
Create the Tkinter window and add labels and buttons for user interaction.
-
When the “Recognize” button is clicked, the Speech recognition function is called, disabling the button and starting the speech recognition process in the background.
-
The background thread continuously reads audio input from the microphone, performs speech recognition, and updates the GUI label to indicate the recognition status.
-
If the speech is recognized successfully and contains valid country and category information, the application fetches news articles using the NewsAPI and generates enhanced text using the GPT-3.5 model.
-
The generated speech is played using pygame, and the news content is displayed in a news ticker animation on the Tkinter window.
-
The animation loops, moving the news content from right to left until the entire text is displayed.
-
The user can speak again to trigger another speech recognition process.