-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Project: awesome-streamlit #107
Comments
I'm just listening to the awesome "Talk Python Podcast" where you are joking about "let's be realistic. You will need html and javascript until they put Python in the browser". That is no longer true. Streamlit solves this using very efficient caching and communication protocols. And it's very, very performant. They just neeed some more components, style and layout options. But that will come. It's a game changer for web development in Python. I believe :-) And please challenge me :-) Please checkout the application at |
And the source code for the Spreadsheet gallery example is """Page to show that its really easy to create a Spreadsheet like application"""
import pandas as pd
import streamlit as st
@st.cache
def get_biostats_data(url) -> pd.DataFrame:
"""A DataFrame of data from https://people.sc.fsu.edu/~jburkardt/data/csv/biostats.csv
Returns:
pd.DataFrame -- [description]
"""
data = pd.read_csv(url)
columns = {
"Name": "Name",
' "Sex"': "Sex",
' "Age"': "Age",
' "Height (in)"': "Height (in)",
' "Weight (lbs)"': "Weight (lbs)",
}
data = data.rename(columns=columns)
return data
@st.cache
def transform_biostats_data(source_data: pd.DataFrame) -> pd.DataFrame:
return source_data
@st.cache
def get_grades_data(url: str) -> pd.DataFrame:
source_data = pd.read_csv(source_url)
columns = {
"Last name": "Last name",
' "First name"': "First name",
' "SSN"': "SSN",
' "Test1"': "Test1",
' "Test2"': "Test2",
' "Test3"': "Test3",
' "Test4"': "Test4",
' "Final"': "Final",
' "Grade"': "Grade",
}
source_data = source_data.rename(columns=columns)
source_data["Test1"] = pd.to_numeric(source_data["Test1"], errors="coerce")
source_data["First name"] = source_data["First name"].str.replace('"', "")
return source_data
@st.cache
def transform_grades_data(source_data: pd.DataFrame) -> pd.DataFrame:
# Add formulas
transform_data = source_data.copy()
transform_data["Test Mean"] = (
transform_data[["Test1", "Test2", "Test3", "Test4"]].mean(axis=1).round()
)
transform_data["Relative diff from 1 to 4 (%)"] = (
(transform_data["Test4"] - transform_data["Test1"])
/ transform_data["Test1"]
* 100
).round()
return transform_data
st.markdown(
"""
This app illustrates that it's so easy to create high quality spreadsheet like apps
with [Streamlit](https://streamlit.io). You can **change the sheet** or **hide/show**
the source data via the sidebar!"""
)
st.sidebar.title("Spreadsheet")
sheet = st.sidebar.selectbox("Select Sheet", ["Biostats", "Grades"])
show_source_data = st.sidebar.checkbox("Show Source Data", value=True)
st.write(f"""## {sheet}""")
if sheet == "Biostats":
with st.spinner("Loading source data ..."):
source_url = "https://people.sc.fsu.edu/~jburkardt/data/csv/biostats.csv"
source_data = get_biostats_data(source_url)
transform_data = transform_biostats_data(source_data)
measures = ["Age", "Height (in)", "Weight (lbs)"]
# Show
measure = st.selectbox("Measure", ["Age", "Height (in)", "Weight (lbs)"])
with st.spinner("Updating plot ..."):
selected = pd.DataFrame(transform_data[measure])
st.bar_chart(selected)
elif sheet == "Grades":
with st.spinner("Loading source data ..."):
source_url = "https://people.sc.fsu.edu/~jburkardt/data/csv/grades.csv"
source_data = get_grades_data(source_url)
transform_data = transform_grades_data(source_data)
# Show
st.write( # pylint-disable=line-too-long
"I illustrate a calculation by calculating the Test Mean."
" After that we illustrate a calculation to show how much better the students did"
" the 4th test compared to 1st one.",
transform_data[
[
"First name",
"Last name",
"Test1",
"Test2",
"Test3",
"Test4",
"Test Mean",
"Relative diff from 1 to 4 (%)",
]
],
)
# Show Soure
if show_source_data:
st.subheader("Source Data")
st.markdown(f"[{source_url}]({source_url})")
st.dataframe(source_data) |
Ines Montani the author behind Spacy put out this one and the code is
|
Very interesting! Certainly seems like a new class of application is emerging. For the record, it still uses js/typescript, but it's great that the application developer doesn't have to write it themselves. I'll have to take a bit of time to evaluate this new approach, especially as it's still emerging. Thanks for bringing it to my attention! |
As the admittedly biased co-creator of Streamlit. I agree that would be totally awesome to include awesome streamlit in awesome python. What could be more meta? Or more awesome? Or more pythonic? ;-) Seriously though, please let me know if I can answer any questions or in any way help this effort! |
Thanks @mahmoud . Yes it definately uses js/ typescript :-) But let the really skilled front end developers do that. They can develop general web components to be used by Streamlit. And let the rest of us from hobbyist to rockstar pythonista get our things done. I've updated the first post above with a video animation and an image of the youtube video because I think they are awesome. I know that you might not think awesome-streamlit.org is awesome (enough yet :-)). But I believe Streamlit is or could be a game changer for awesome python apps in general. Have a nice weekend. |
Basic info
Application name: Awesome Streamlit
Application repo link: https://github.com/marcskovmadsen/awesome-streamlit
Application home link: https://awesome-streamlit.org/
Application Docs: https://awesome-streamlit.readthedocs.io/
Application Docker Image: https://cloud.docker.com/u/marcskovmadsen/repository/docker/marcskovmadsen/awesome-streamlit
Application Package: https://pypi.org/project/streamlit/
Application description:
The purpose of the Awesome Streamlit Application is to share knowledge on how Awesome Streamlit is and can become as a technology for building (data) applications in Python.
This application provides
Qualifications
The application and repo is new. But the reason why I believe this application is important is because it is the first application to take advantage of the Streamlit framework which has the potential to significantly lower the friction required to develop (applications) in Python.
It's so easy and awesome. See this 4 minute introduction to Streamlit
I believe the Streamlit Technology will foster a flood of awesome (micro) apps in Python. So the Streamlit technology is important to your list :-)
The application and repo already provides and will provide tons on information on how to develop, test, build and release these types of applications.
If you have helpfull helps or suggestions feel free to add them to the comments
Best regards and thanks.
Marc
The text was updated successfully, but these errors were encountered: