inumulaisk commited on
Commit
da9fd39
1 Parent(s): a4fc3fc

added code file

Browse files
Files changed (1) hide show
  1. my_gpt_file.py +15 -0
my_gpt_file.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import os
3
+ import gradio as gr
4
+ from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader
5
+
6
+ os.environ["OPENAI_API_KEY"] = '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'
7
+
8
+ def query_documents(qry):
9
+ index = GPTVectorStoreIndex.from_documents("E:/Organisation GIt/GPT_Project/input_files/docs/")
10
+ query_engine = index.as_query_engine()
11
+ response = query_engine.query(qry).response
12
+ return response
13
+
14
+ iface = gr.Interface(fn=query_documents, inputs="text", outputs="text", title="PiLog GPT Assistant")
15
+ iface.launch(share=True)