Kvikontent commited on
Commit
a5a848e
1 Parent(s): 38b2581

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -7
app.py CHANGED
@@ -1,13 +1,30 @@
1
  import streamlit as st
2
- from freeGPT import Client
 
3
 
4
  st.title("ChatGPT4 UI")
5
  cont = st.container(height=600)
6
  prompt = st.chat_input(placeholder="Eg. How are you?")
7
 
8
- if prompt:
9
- output = Client.create_completion("gpt3", prompt)
10
- user_pr = cont.chat_message("user")
11
- user_pr.write(prompt)
12
- output_msg = cont.chat_message("assistant")
13
- output_msg.write(output)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import logging
3
+ from bing_chat import UnlimBotChat
4
 
5
  st.title("ChatGPT4 UI")
6
  cont = st.container(height=600)
7
  prompt = st.chat_input(placeholder="Eg. How are you?")
8
 
9
+ logging.basicConfig(level=logging.INFO)
10
+
11
+ chat = UnlimBotChat("")
12
+
13
+ def main():
14
+ st.title("ChatGPT4 UI")
15
+ cont = st.container(height=600)
16
+ prompt = st.chat_input(placeholder="Eg. How are you?")
17
+
18
+ if st.button("Send"):
19
+ messages = chat.run(prompt)
20
+
21
+ for message in messages:
22
+ if message['source'] == 'user':
23
+ user_msg = cont.chat_message("user")
24
+ user_msg.write(message['message'])
25
+ elif message['source'] == 'bing':
26
+ out_msg = cont.chat_message("assistant")
27
+ out_msg.write(message['message'])
28
+
29
+ if __name__ == "__main__":
30
+ main()