Skip to content
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

Optimize Resource Consumption and User Experience in Streamlit App #31

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

IndigoWizard
Copy link
Owner

@IndigoWizard IndigoWizard commented Oct 30, 2023

REMAINDER! Please make your PRs to the develop branch, not streamlit-app branch.

Main PR gist

This pull request addresses an issue with resource consumption and frequent app refreshes in the Streamlit app. The problem arose when the app gained popularity and was shared on social media, resulting in excessive resource consumption due to the way Streamlit handles user input where the app refreshes every time any input value is altered, causing crashes when it comes to multiple inputs.

Issue ticket

Type of change

Check relevant options and delete options not relevant to this PR:

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Enhancement (maintenance, updating code structure, cleaning up code)

Changes description

  • Improved the user experience by reducing unnecessary refreshes upon each input change through a bulk input using st.form
  • Modified the app to render the Folium map from the start with default values, allowing users to input values before processing.

Preview

Before After
before after
individual inputs with huge time load single form input with single time load

Checklist

  • I have tested these changes locally.
  • I have checked the code to ensure it follows the project's coding standards.
  • I have updated the documentation (if applicable).
  • I have added or modified unit tests (if applicable).
  • All existing tests pass successfully.

- using a form to setup the app input widgets to avoid the unecessary processing when the app is started
- making the button take up 100% the width of the column to match with other st elements above within the same column
@IndigoWizard IndigoWizard self-assigned this Oct 30, 2023
@IndigoWizard IndigoWizard added earth-engine Google Earth Engine (GEE) Folium Folium Streamlit ✨ enhancement ✨ enhancement 🧪 Testing New changes are in testing phase 🌟feature 🌟feature labels Oct 30, 2023
@IndigoWizard IndigoWizard marked this pull request as ready for review October 30, 2023 23:58
@IndigoWizard IndigoWizard merged commit 87f3a6c into dev Oct 31, 2023
@IndigoWizard IndigoWizard added Done ✅ and removed 🧪 Testing New changes are in testing phase labels Oct 31, 2023
@IndigoWizard IndigoWizard deleted the feature/optimization-user-input branch October 31, 2023 00:10
@IndigoWizard IndigoWizard added the hacktoberfest-accepted hacktoberfest-accepted label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Done ✅ earth-engine Google Earth Engine (GEE) ✨ enhancement ✨ enhancement 🌟feature 🌟feature Folium Folium hacktoberfest-accepted hacktoberfest-accepted Streamlit
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

App optimization - Resource Consumption - Streamlit Cloud free tier Crash
1 participant