File size: 800 Bytes
a116079
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()