File size: 562 Bytes
da9fd39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import openai
import os
import gradio as gr
from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader

os.environ["OPENAI_API_KEY"] = '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'

def query_documents(qry):
    index = GPTVectorStoreIndex.from_documents("E:/Organisation GIt/GPT_Project/input_files/docs/")
    query_engine = index.as_query_engine()
    response = query_engine.query(qry).response
    return response

iface = gr.Interface(fn=query_documents, inputs="text", outputs="text", title="PiLog GPT Assistant")
iface.launch(share=True)