#for learning import os import openai import gradio as gr openai.api_key = os.environ.get('O_APIKey') Data_Read = os.environ.get('Data_Reader') ChurnData = os.environ.get('Churn_Data') ChurnData2 = os.environ.get('Churn_Data2') #read data from llama_index import VectorStoreIndex, SimpleDirectoryReader, SummaryIndex, download_loader DataReader = download_loader(Data_Read) loader = DataReader() #loading options # loader = SimpleDirectoryReader(input_files = ["pdf1","pdf2"]) # documents = loader.load_data() # or # documents = loader.load_data(file=['toolkit.pdf','pdf2','pdf3']) ### 1st file documents = loader.load_data(file=ChurnData) ### 1st file ### 2nd file documents2 = loader.load_data(file=ChurnData2) documents = documents + documents2 ### 2nd file index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine() def reply(message, history): answer = str(query_engine.query(message)) return answer Conversing = gr.ChatInterface(reply, chatbot=gr.Chatbot(height=500), retry_btn=None,theme=gr.themes.Monochrome(), title = 'ECommerce And Digital Marketing 2024 Toolkit Q&A', undo_btn = None, clear_btn = None, css='footer {visibility: hidden}').launch()