Spaces:
Runtime error
Runtime error
Kvikontent
commited on
Commit
•
a5a848e
1
Parent(s):
38b2581
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,30 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
|
|
3 |
|
4 |
st.title("ChatGPT4 UI")
|
5 |
cont = st.container(height=600)
|
6 |
prompt = st.chat_input(placeholder="Eg. How are you?")
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|