-
Book Overview & Buying
-
Table Of Contents
Unlocking Data with Generative AI and RAG - Second Edition
By :
This code picks up right where we left off in Chapter 5, except for the last set of lines representing the prompt probe attack. As we have at the beginning of all of our code labs, we are going to start with installing a new package, which is, of course, Gradio! We are also going to uninstall uvloop, because of a conflict with our other packages:
%pip install gradio ==6.0.2
%pip install nest_asyncio==1.6.0
%pip uninstall uvloop -y
The first line installs Gradio itself, which is the UI framework we will use throughout this chapter. The second line installs nest_asyncio, a utility package that patches Python’s asyncio module to allow nested event loops. This is necessary because Jupyter notebooks already run their own event loop, and Gradio needs to run another one inside it. Without nest_asyncio, you would encounter a “RuntimeError: This event loop is already running" error when trying to launch your Gradio interface...