Spaces:
Runtime error
Runtime error
import os | |
import openai | |
import streamlit as st | |
from models.langOpen import LangOpen | |
from utils.chatbox import chatbox | |
st.set_page_config(page_title="Langchain", page_icon="") | |
st.subheader("Langchain with OpenAI Demo") | |
if "messages" not in st.session_state: | |
st.session_state.messages = [] | |
if "openai_api_key" not in st.session_state: | |
st.info("Enter your openai key to access the chatbot.") | |
else: | |
option = st.selectbox( | |
label="Select your model:", options=("gpt-3.5-turbo", "gpt-4") | |
) | |
with st.spinner(f"Initializing {option} ..."): | |
langOpen = LangOpen(model_name=option) | |
chatbox("lang_open", langOpen) | |