plotly_streamlit.py: add easy profiling

This commit is contained in:
frederik
2024-01-30 15:56:11 +01:00
parent 4ef301365f
commit 66a3af6f9f
+16
View File
@@ -14,6 +14,18 @@ from sklearn.preprocessing import normalize
from suntime import Sun
from datetime import datetime
profile = False
if profile:
try:
from pyinstrument import Profiler
except ImportError as e:
print(e)
profile = False
else:
profiler = Profiler()
profiler.start()
pio.templates.default = "plotly_white"
userDir = os.path.expanduser('~')
@@ -539,3 +551,7 @@ else:
# audio_file = open('/home/*/BirdSongs/Extracted/By_Date/2022-03-22/Yellow-streaked_Greenbul/Yellow-streaked_Greenbul-77-2022-03-22-birdnet-15:04:28.mp3', 'rb')
# audio_bytes = audio_file.read()
# cols4.audio(audio_bytes, format='audio/mp3')
if profile:
profiler.stop()
profiler.print()
print('**profiler done**', flush=True)