rbughao's picture
Update app.py
d72146a
raw
history blame
744 Bytes
#for learning
import os
import openai
from google.colab import userdata
import gradio as gr
openai.api_key = userdata.get('O_APIKey')
#using a folder
from llama_index import VectorStoreIndex, SimpleDirectoryReader, SummaryIndex
documents = SimpleDirectoryReader('EComm').load_data()
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 = 'E-Commerce And Digital Marketing Toolkit Q&A', undo_btn = None, clear_btn = None, css='footer {visibility: hidden}').launch()