Spaces:
Sleeping
Sleeping
Update app.py
Browse files156 unmodified lines157158159160160161162163164165166167168169170171172173161162163164165166167168169170171172173174175176177156 unmodified lines if st.session_state.submit: if uploaded_files: client = OpenAI(api_key=openai_api_key)
# test api key try: response = client.chat.completions.create( model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Say this is a test"} ] ) except: st.session_state.clear() st.session_state.error = "OpenAI API key is invalid" st.rerun() with st.spinner("Loading, please be patient with us ... 🙏"): # test api key try: response = client.chat.completions.create( model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Say this is a test"} ] ) except: st.session_state.clear() st.session_state.error = "OpenAI API key is invalid" st.rerun() with st.spinner("Loading, please be patient with us ... 🙏"): textify_output = read_and_textify_advanced(uploaded_files, sentence_chunks)app.py+15-14