Page displaying blank

Hi - complete newbie here.

I’ve created very basic code following along with this tutorial here. The page in the browser is blank (see image) when running ‘streamlit run app.py’.

See code below:

import os
from apikey import apikey

import streamlit as st
from langchain.llms import OpenAI

os.environ[‘OPENAI_API_KEY’] = apikey

st.title(‘:parrot::link: YouTube GPT Creator’)
prompt = st.text_input(‘Plug in your prompt here’)

The expected behaviour is a title and box for text input will be displayed.

I have installed Langchain and Streamlit.

Any help wou;d be appreciated.
Joe

Does it works if you don’t use the apikey library (it’s kind of outdated), for example like this:

import os
import streamlit as st
from langchain.llms import OpenAI

os.environ['OPENAI_API_KEY'] = 'YOUR_API_KEY'
st.title('YouTube GPT Creator')
prompt = st.text_input('Plug in your prompt here')

You can also use other secrets management tools like dotenv or preferably streamlit secrets - Secrets management - Streamlit Docs

Thank you for your reply - unfortunately that results in this message:

You have not installed the apikey python package that’s why you initial code was not working. If you don’t want to use apikey (which I recommend), you need to remove the apikey import statement from your code.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.