Spaces:
Running
Running
# https://docs.streamlit.io/knowledge-base/tutorials/build-conversational-apps | |
import os | |
import openai | |
import requests | |
import streamlit as st | |
from utils.util import * | |
st.set_page_config(page_title="RegBotBeta", page_icon="📜🤖") | |
st.title("Welcome to RegBotBeta2.0") | |
st.header("Powered by `LlamaIndex🦙`, `Langchain🦜🔗 ` and `OpenAI API`") | |
api_key = st.text_input("Enter your OpenAI API key here:", type="password") | |
if api_key: | |
resp = validate(api_key) | |
if "error" in resp.json(): | |
st.info("Invalid Token! Try again.") | |
else: | |
st.info("Success") | |
os.environ["OPENAI_API_KEY"] = api_key | |
openai.api_key = api_key | |
if "openai_api_key" not in st.session_state: | |
st.session_state.openai_api_key = "" | |
st.session_state.openai_api_key = api_key | |