File size: 529 Bytes
137ca1e
358293d
137ca1e
 
 
358293d
 
 
 
 
137ca1e
358293d
137ca1e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio
from llama_index import SimpleDirectoryReader, GPTListIndex, readers, GPTSimpleVectorIndex, LLMPredictor, PromptHelper, ServiceContext

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)