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