Hello, I’m not able to use the lux library streamlit. can you guide us on how to use below URL library in streamlit? Note: lux library works on jupyter notebook .ipynb file but my code works on .py file
Hi @arjunko, welcome to the Streamlit community!
Based on the README here, this appears to be a Jupyter Notebook/Jupyterlab extension, and as far as I know, no one has written a Streamlit wrapper. Looks like a really useful tool though, would be great if someone in the community wrote a Streamlit component for it!
Best,
Randy
Hi @arjunko @randyzwitch, I’ve recently added the ability for Lux to integrate with Streamlit Components. You can read more about it here. Hope that helps!
Hi, Am facing this error for the code that is posted in the demo docs
Blockquote
import pandas as pd
import streamlit as st
import streamlit.components.v1 as components
st.title(‘Analysis of Happy Planet Index Dataset’)
st.write(‘Check out these cool visualizations!’)
df = pd.read_csv(“https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/hpi.csv”)
df.default_display = “lux” # Set Lux as default display
html_content = df.save_as_html()
components.html(html_content, width=800, height=350)
st.write(df)
$ conda list
lux-api 0.3.0
lux-widget 0.1.5
Any help is appreciated.
@stonelazy
Doesn’t look like you imported lux in that code.
Try it this way.
import streamlit as st
import streamlit.components.v1 as components
import pandas as pd
import lux
def app():
st.title('Analysis of Happy Planet Index Dataset')
st.write('Check out these cool visualizations!')
df = pd.read_csv("https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/hpi.csv")
export_file = 'visualizations.html'
df.save_as_html(export_file)
html = open(export_file, 'r').read()
components.html(html, width=800, height=350)
app()