Gradio RAG tutorial with llama_index

Please reference this blog post on how to use this notebook.

Install dependencies

Make an app with Gradio

This is a simple RAG chatbot built on top of Llama Index and Gradio. It allows you to upload any text or PDF files and ask questions about them! Before running this, make sure you have exported your OpenAI API key as an environment variable:

export OPENAI_API_KEY="mykey"
oai_key = os.getenv('OPENAI_API_KEY')
print(oai_key)
your-openai-api-key

answer

 answer (message, history)
!echo $HF_ENDPOINT
# this is only necessary in a notebook
iface.close()
Closing server running on port: 7860

Create a requirements.txt file

fastcore
Writing ../requirements.txt

Convert this notebook into a Gradio app

# from nbdev.export import nb_export
# nb_export('01_gradio.ipynb', lib_path='.', name='gradio')