gpt3_chatbot2 / app.py
abcde1234www's picture
Duplicate from yf12/gpt3_chatbot
e729a17
raw
history blame contribute delete
800 Bytes
import openai
import gradio as gr
import uuid
import os
from gpt_model import *
openai.api_key = os.environ.get('secret_key')
gpt = GPT_Model(append_output_prefix_to_query=True)
gpt.add_example(Example('hi','Hello, how are you?'))
gpt.add_example(Example('What is Neo Ivy Capital','The Neo Ivy Capital Fund is a quantitative hedge fund that invests in liquid, publicly traded equity securities via artificial intelligence strategies.'))
gpt.add_example(Example('Who is the CEO of Neo Ivy Capital','The CEO of Neo Ivy Capital is Renee Yao'))
def chatbot(input, history=[]):
output = gpt.submit_request(input)
history.append((input, output))
return history, history
gr.Interface(fn = chatbot,
inputs = ["text",'state'],
outputs = ["chatbot",'state']).launch()