File size: 569 Bytes
5587c60
45e8936
 
 
d329284
45e8936
 
 
 
 
 
 
 
 
 
5587c60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from gpt_index import GPTSimpleVectorIndex
import gradio as gr
import os

os.environ["OPENAI_API_KEY"] = "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"

def chatbot(input_text):
    index = GPTSimpleVectorIndex.load_from_disk('index.json')
    response = index.query(input_text)
    return response.response

demo = gr.Interface(fn=chatbot,
                    inputs=gr.components.Textbox(lines=7, label="Enter your question"),
                    outputs=gr.components.Textbox(lines=7, label="Answer"),
                    title="NFT AI Chatbot")
demo.launch()