File size: 821 Bytes
23a229c
 
0809507
 
402c1d3
0809507
0e8a2bc
 
3b7cf58
0809507
19f4fce
23a229c
19f4fce
 
91caeb5
0809507
91caeb5
1230ae3
 
402c1d3
3b7cf58
1230ae3
3b7cf58
1230ae3
402c1d3
23a229c
19f4fce
 
23a229c
19f4fce
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
# 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