llm_email / app.py
JoFrost's picture
chore: clean up unused imports
9906fd4
raw
history blame
593 Bytes
import gradio as gr
from llama_index import GPTSimpleVectorIndex
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.Button("Clear")
def respond(message, chat_history):
bot_message = str(index.query(message)).strip()
chat_history.append((message, bot_message))
return "", chat_history
msg.submit(respond, [msg, chatbot], [msg, chatbot])
clear.click(lambda: None, None, chatbot, queue=False)
if __name__ == "__main__":
global index
index = GPTSimpleVectorIndex.load_from_disk('email.json')
demo.launch()