DIDx_CX_Chatbot / app.py
Aqdas's picture
Update app.py
e6bec3e
raw
history blame contribute delete
860 Bytes
import streamlit as st
import os
from chatbot import Assistant_DIDx
import openai
client = openai.OpenAI(api_key=os.environ['openai_api_key'])
didx_chatbot = Assistant_DIDx(client)
st.title("Assistant API → DIDx CX Chatbot")
access_code = st.text_input('Please Enter the access code')
if access_code == os.environ['token']:
col1, col2 = st.columns(2)
with col1:
user_id = st.text_input('Please Enter user ID')
with col2:
password = st.text_input('Please Enter Password', type="password")
didx_chatbot.user_auth(user_id,password)
user_input = st.text_input('How can I help you?')
with st.spinner('Sit back and relax. It takes a while.'):
if st.button('Ask'):
if user_input:
answer = didx_chatbot.chat_user(client, user_input)
st.markdown(answer)