Running the same function from notebook or from is very slow - X6 slower

I am implementing segment anything with some modifications/additions and when I test my code on a local image using a jupyter notebook it takes ~10sec.
The same exact code in Streamlit takes ~60 sec.

The specific code that runs slow

sam = SAM(
        device= 'cpu',
sam.set_image(<image path>)

set_image triggers the embedding calculations and I can see why it might take 10 sec, but what could cause it to run for 60 sec running in Streamlit?

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