File size: 744 Bytes
19dd0e8
 
 
 
 
 
d72146a
19dd0e8
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#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()