File size: 828 Bytes
6f43702
a5a848e
 
6f43702
 
0491265
f3a5963
6f43702
a5a848e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import streamlit as st
import logging
from bing_chat import UnlimBotChat

st.title("ChatGPT4 UI")
cont = st.container(height=600)
prompt = st.chat_input(placeholder="Eg. How are you?")

logging.basicConfig(level=logging.INFO)

chat = UnlimBotChat("")

def main():
    st.title("ChatGPT4 UI")
    cont = st.container(height=600)
    prompt = st.chat_input(placeholder="Eg. How are you?")
    
    if st.button("Send"):
        messages = chat.run(prompt)

        for message in messages:
            if message['source'] == 'user':
                user_msg = cont.chat_message("user")
                user_msg.write(message['message'])
            elif message['source'] == 'bing':
                out_msg = cont.chat_message("assistant")
                out_msg.write(message['message'])

if __name__ == "__main__":
    main()