Shubham89's picture
Update app.py
b6883f5
raw
history blame
625 Bytes
import gradio
import os
from llama_index import SimpleDirectoryReader, GPTListIndex, readers, GPTSimpleVectorIndex, LLMPredictor, PromptHelper, ServiceContext
#openai.api_key = "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"
os.environ["OPENAI_API_KEY"] = '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'
def gradio_ask_ai(user input):
index = GPTSimpleVectorIndex.load_from_disk('index.json')
query = user_input
response = index.query(query)
return response.response
demo = gradio.Interface(fn=gradio_ask_ai, inputs = "text", outputs = "text", title = "Meshwork bot")
demo.launch(inline=False)