Building AI Applications with ChatGPT APIs....2
Contributors....5
About the Author....5
About the Reviewers....5
Preface....15
Who this book is for....16
What this book covers....17
To get the most out of this book....18
Download the example code files....19
Get in touch....20
Share Your Thoughts....20
Download a free PDF copy of this book....21
Part 1:Getting Started with OpenAI APIs....22
Chapter 1: Beginning with the ChatGPT API for NLP Tasks....23
Technical Requirements....23
The ChatGPT Revolution....24
Using ChatGPT from the Web....25
Creating an OpenAI Account....25
ChatGPT Web Interface....27
Getting Started with the ChatGPT API....30
Obtaining an API Key....30
API Tokens and Pricing....32
Setting Up Your Python Development Environment....34
Installing Python and the PyCharm IDE....35
Setting Up a Python Virtual Environment....35
The pip Package Installer....37
Building a Python Virtual Environment from the Terminal....38
A Simple ChatGPT API Response....38
Summary....42
Chapter 2: Building a ChatGPT Clone....44
Technical Requirements....45
Creating a ChatGPT Clone with Flask....45
Frontend HTML Generation....49
Enhancing the ChatGPT Clone Design....52
Intercepting ChatGPT API Endpoints....53
Summary....55
Part 2: Building Web Applications with the ChatGPT API....57
Chapter 3: Creating and Deploying an AI Code Bug Fixing SaaS Application Using Flask....58
Technical Requirements....58
Performing Multiple ChatGPT API Requests....59
Setting Up the Code Bug Fixer Project....60
Implementing the Code Bug Fixer Backend....62
Using Text Areas and Containers....64
Testing the Code Bug Fixer App....68
Deploying the ChatGPT App to the Azure Cloud....71
Summary....75
Chapter 4: Integrating the Code Bug Fixer Application with a Payment Service....77
Technical Requirements....77
Integrating Payments with Stripe....78
Setting Up a SQL User Database....80
Initializing a SQL Database....81
Getting a Browser Fingerprint ID....83
Tracking Application Users....84
Implementing the Usage Counters....86
Adding Payments to a ChatGPT Application....89
Building the Payments Page....89
Confirming User Payments....94
Summary....97
Chapter 5: Quiz Generation App with ChatGPT and Django....99
Technical Requirements....100
Building a Django Project....100
Creating the Exam App Frame and Views....104
Connecting Django Views and URLs....104
Developing Django Templates....107
Running Your Django Application....111
Integrating ChatGPT and Django for Quiz Generation....113
Building the Quiz Generation Text Area and Submit Button....113
Creating ChatGPT API Views with Django....115
Storing and Downloading Generated Quizzes....119
Saving the Quizzes in an SQLite Database....120
Building the Download Quiz View....122
Designing the Download Template....124
Summary....127
Part 3: The ChatGPT, DALL-E, and Whisper APIs for Desktop Apps Development....129
Chapter 6: Language Translation Desktop App with the ChatGPT API and Microsoft Word....130
Technical Requirements....130
Integrating ChatGPT API with Microsoft Office....131
Building a User Interface with Tkinter....133
Integrating Microsoft Word Text with the ChatGPT API....138
Translating a Word Text with ChatGPT 3.5 Turbo....138
Summary....143
Chapter 7: Building an Outlook Email Reply Generator....145
Technical Requirements....146
Passing Outlook Data to the ChatGPT API....146
Setting Up the Outlook Email....147
Accessing Email Data with the win32com Client....149
Generating automatic email replies....153
Summary....159
Chapter 8: Essay Generation Tool with PyQt and the ChatGPT API....160
Technical Requirements....161
Building a Desktop Application with PyQT....161
Setting Up the Essay Generation Tool Project....162
Building the Application GUI with PyQt....163
Creating Essay Generation Methods with the ChatGPT API....168
Controlling the ChatGPT API Tokens....170
Summary....173
Chapter 9: Integrating ChatGPT and DALL-E API: Build End-to-End PowerPoint Presentation Generator....174
Technical Requirements....175
Using DALL-E and the DALL-E API....175
Building PowerPoint Apps with the PPTX Python Framework....177
Generating Art with the DALL-E API....181
Finalizing and Testing the AI Presentation Generator....183
Summary....188
Chapter 10: Speech Recognition and Text-to-Speech with the Whisper API....189
Technical Requirements....190
Implementing Text Translation and Transcription with the Whisper API....190
Building a Voice Transcriber Application....194
Using PyDub for Longer Audio Inputs....197
Summary....198
Part 4:Advanced Concepts for Powering ChatGPT Apps....200
Chapter 11: Choosing the Right ChatGPT API Model....201
Technical Requirements....202
ChatGPT API Models – GPT-3, GPT-4, and Beyond....202
Using Chat Completion Parameters....206
ChatGPT API Rate Limits....211
Summary....213
Chapter 12: Fine-Tuning ChatGPT to Create Unique API Models....214
Technical Requirements....214
Fine-Tuning ChatGPT....215
Fine-Tuned Model Dataset Preparation....217
Building and Using the Fine-Tuned Model....221
Summary....225
Index....227
Why subscribe?....236
Other Books You May Enjoy....236
Packt is searching for authors like you....238
Download a free PDF copy of this book....239
Combining ChatGPT APIs with Python opens doors to building extraordinary AI applications. By leveraging these APIs, you can focus on the application logic and user experience, while ChatGPT's robust NLP capabilities handle the intricacies of human-like text understanding and generation.
This book is a guide for beginners to master the ChatGPT, Whisper, and DALL-E APIs by building ten innovative AI projects. These projects offer practical experience in integrating ChatGPT with frameworks and tools such as Flask, Django, Microsoft Office APIs, and PyQt.
Throughout this book, you'll get to grips with performing NLP tasks, building a ChatGPT clone, and creating an AI-driven code bug fixing SaaS application. You'll also cover speech recognition, text-to-speech functionalities, language translation, and generation of email replies and PowerPoint presentations. This book teaches you how to fine-tune ChatGPT and generate AI art using DALL-E APIs, and then offers insights into selling your apps by integrating ChatGPT API with Stripe.
With practical examples available on GitHub, the book gradually progresses from easy to advanced topics, cultivating the expertise required to develop, deploy, and monetize your own groundbreaking applications by harnessing the full potential of ChatGPT APIs.
With best practices, tips, and tricks for building applications using the ChatGPT API, this book is for programmers, entrepreneurs, and software enthusiasts. Python developers interested in AI applications involving ChatGPT, software developers who want to integrate AI technology, and web developers looking to create AI-powered web applications with ChatGPT will also find this book useful. A fundamental understanding of Python programming and experience of working with APIs will help you make the most of this book.