Spaces:
Sleeping
Sleeping
File size: 625 Bytes
137ca1e de170a6 358293d 137ca1e de170a6 137ca1e b6883f5 358293d 137ca1e b6883f5 137ca1e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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) |