Run streamlit on databricks notebook

Summary

I’m using streamlit on databricks notebook. How do i execute the code? When i run the cell in notebook with the streamlit code, i get the below error.
2022-12-16 12:27:30.624 Received command c on object id p0
SyntaxError: invalid syntax
File β€œβ€, line 1
streamlit run /databricks/python_shell/scripts/PythonShell.py [argument]

Apparently the notebook can only understand python code. Maybe you can launch the streamlit app in a subprocess.

@Goyo
Do you have a sample code to help me out? im new to databricks and to streamlit
–Sonia

This works for me in a standard python interpreter:

subprocess.run(["streamlit", "run", "/databricks/python_shell/scripts/PythonShell.py"])

It may or may not do something useful in the databricks notebook, I know nothing about databricks.

1 Like