PBG / app.py
mgupta70's picture
transformers
f62b103
raw
history blame
1.17 kB
import os
import time
import gradio as gr
import openai
from llama_index import GPTSimpleVectorIndex, Document, SimpleDirectoryReader
#from Crypto.Cipher import AES
os.environ['OPENAI_API_KEY'] = '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'
filename = 'Penta_index_demo.json'
index = GPTSimpleVectorIndex.load_from_disk('{}'.format(filename))
def get_model_reply_no_prev_context(query):
response = index.query(query)
final_response = response.response
return final_response
# App
title = "Knowledge Center at Penta Building Group"
description = """
The program is trained to answer questions based on the documentation of 'Lessons Learned' from previous projects!
<img src="https://huggingface.co/spaces/mgupta70/PBG/blob/main/penta.png" width=200px>
"""
article = "Your feedback matters!If you like it, contact me at mgupta70@asu.edu"
gr.Interface(
fn=get_model_reply_no_prev_context,
inputs="textbox",
outputs="text",
title=title,
description=description,
article=article,
examples=[["Which code is to be used while planning a pedestrian walkway?"], ["What is AHJ?"]], live=True
).launch(share=True)