Spaces:
Runtime error
Runtime error
File size: 862 Bytes
7619c7f 875cbe4 7619c7f 875cbe4 7619c7f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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")
api_key = os.environ['OPENAI_API_KEY']
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
|