Denys9's picture
Update app.py
24c97b5
raw
history blame contribute delete
576 Bytes
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="Gamecraft AI Chatbot")
demo.launch()