Commit
•
d86584f
1
Parent(s):
225ce96
Create bot.py
Browse files
bot.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import os
|
3 |
+
from main import DIDx_Chatbot
|
4 |
+
|
5 |
+
abc = DIDx_Chatbot()
|
6 |
+
|
7 |
+
st.title("DIDX Bot (Powered by OpenAI Assistant!")
|
8 |
+
|
9 |
+
access_code = st.text_input('Please Enter your access code', type="password")
|
10 |
+
|
11 |
+
if access_code == os.environ['token']:
|
12 |
+
col1, col2 = st.columns(2)
|
13 |
+
with col1:
|
14 |
+
user_id = st.text_input('Please Enter user ID')
|
15 |
+
with col2:
|
16 |
+
password = st.text_input('Please Enter Password', type="password")
|
17 |
+
|
18 |
+
abc.user_auth(user_id, password)
|
19 |
+
|
20 |
+
user_input = st.text_input('How can I help you?')
|
21 |
+
with st.spinner('Sit back and relax. It takes a while.'):
|
22 |
+
if st.button('Ask'):
|
23 |
+
if user_input:
|
24 |
+
answer = abc.user_chat(user_input)
|
25 |
+
st.write(answer)
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
|