File size: 548 Bytes
6f43702
 
 
 
c36fa92
6f43702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import streamlit as st
from freeGPT import Client

st.title("ChatGPT4 UI")
cont = st.container(height=400)
prompt = cont.chat_message(placeholder="Eg. How are you?")
num_user_msg = 0
num_ai_msg = 0
ai_msg = []
user_msg = []

if prompt:
    num_user_msg += 1
    num_ai_msg += 1
    output = Client.create_completion("gpt3", prompt)
    user_pr = cont.chat_message
    user_msg.append(user_pr)
    user_msg[num_user_msg].write(prompt)
    output_msg = cont.chat_message("assistant")
    ai_msg.append(output_msg)
    ai_msg[num_ai_msg].write(output)