Spaces:
No application file
No application file
| 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) | |