Whenever i run the streamlit intially i getting the below error
streamlit.errors.StreamlitAPIException: set_page_config() can only be called once per app, and must be called as the first Streamlit command in your script.
after refreshing the page the error is gone and im using the set_page_config()` only once in the script
Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here and please update your post to include a code snippet (+ what version of Streamlit you’re running) so we can try to reproduce the issue.
import streamlit as st
import os
from utils import*
import pandas as pd
import numpy as np
import pandas as pd
from dtaidistance import dtw
import mass_ts as mts
from bokeh.plotting import figure, output_file, show
import plotly.express as px
import matplotlib.pyplot as plt
import math
import plotly.io as pio
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import copy
from golden_batch import *
from Polluted import *
from PIL import Image
import warnings
warnings.filterwarnings(“ignore”)
st.set_page_config(page_title=“Dashboard for Batch Analysis”,layout=“wide”)
nav =st.sidebar.radio(“Navigation”,[“Batch-Analysis-1”,“Batch-Analysis-2”])
if nav == “Batch-Analysis-1”:
col1, col2, col3, col4 = st.columns(4)
with col1:
if 'batch_cond' not in st.session_state.keys():
batch_condObj = cUpload("Choose a file for Non-Golden batch")
batch_cond = batch_condObj.FileuploadDisplay()
else:
batch_condObj = st.session_state['batch_cond']
batch_cond = batch_condObj.FileuploadDisplay()
My guess, which is purely a guess since I can’t see the other files in your repository, is that you have some streamlit commands being run in your utils module, so that when you do from utils import *, it actually runs st.<something>. Can you check all of the modules you’re importing from, and see if there are st commands running in them? If so, you could put those inside a function so they won’t run just by importing the module.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.