Spaces:
Runtime error
Runtime error
File size: 787 Bytes
19dd0e8 747633c 19dd0e8 3d27082 77659a5 19dd0e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#for learning
import os
import openai
import gradio as gr
openai.api_key = os.environ.get('O_APIKey')
#using a folder
from llama_index import VectorStoreIndex, SimpleDirectoryReader, SummaryIndex, download_loader
PDFReader = download_loader("PDFReader")
loader = PDFReader()
documents = loader.load_data(file='toolkit.pdf')
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() |