{"id":25651633,"url":"https://github.com/sahilkumardhala/streamlit-learning","last_synced_at":"2026-05-16T04:35:51.641Z","repository":{"id":253131743,"uuid":"842529443","full_name":"sahilkumardhala/Streamlit-LEARNING","owner":"sahilkumardhala","description":"Streamlit is an open-source app framework designed for creating and deploying data-driven web applications quickly and easily, using only Python scripts. It allows developers to transform data scripts into interactive and beautiful apps without the need for front-end experience.","archived":false,"fork":false,"pushed_at":"2024-08-14T18:42:14.000Z","size":340,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-23T15:01:43.814Z","etag":null,"topics":["python3","streamlit"],"latest_commit_sha":null,"homepage":"https://demo-st-learning-sahil.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sahilkumardhala.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-14T14:35:32.000Z","updated_at":"2024-08-14T18:42:17.000Z","dependencies_parsed_at":"2024-08-14T17:52:16.775Z","dependency_job_id":null,"html_url":"https://github.com/sahilkumardhala/Streamlit-LEARNING","commit_stats":null,"previous_names":["sahilkumardhala/streamlit-learning"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilkumardhala%2FStreamlit-LEARNING","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilkumardhala%2FStreamlit-LEARNING/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilkumardhala%2FStreamlit-LEARNING/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahilkumardhala%2FStreamlit-LEARNING/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sahilkumardhala","download_url":"https://codeload.github.com/sahilkumardhala/Streamlit-LEARNING/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240348006,"owners_count":19787239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python3","streamlit"],"created_at":"2025-02-23T17:19:10.240Z","updated_at":"2026-05-16T04:35:51.592Z","avatar_url":"https://github.com/sahilkumardhala.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streamlit-LEARNING\n![Streamlit-LEARNING-iamge](streamlitlogo.png)\n\n[![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://demo-st-learning-sahil.streamlit.app/)\n\n# Abouts:\n\nStreamlit is an open-source app framework designed for creating and deploying data-driven web applications quickly and easily, using only Python scripts. It allows developers to transform data scripts into interactive and beautiful apps without the need for front-end experience. To start using Streamlit, you first need to install it via pip with `pip install streamlit`. Once installed, you can run a Streamlit app by executing the command `streamlit run your_script.py`. Streamlit offers a range of commands and widgets that make building interactive applications straightforward. Some of the essential commands include `st.title()` for setting the app title, `st.header()` and `st.subheader()` for different levels of headings, and `st.text()` for adding simple text. For displaying data, you can use `st.write()`, which automatically formats your data depending on its type, or `st.dataframe()` for interactive tables. You can also create various input widgets like `st.button()`, `st.slider()`, `st.selectbox()`, and `st.text_input()` to capture user input. Additionally, Streamlit supports charting libraries like Matplotlib, Plotly, and Altair through commands such as `st.pyplot()` and `st.plotly_chart()`. Once your app is ready, you can share it with others by deploying it to a web server, or using `Streamlit Cloud` for hosting. Streamlit’s simplicity and versatility make it an excellent choice for data scientists and engineers looking to create web applications efficiently.\n\nAuthor:\n* @sahilkumardhala : https://github.com/sahilkumardhala/sahilkumardhala\n\n\n# Deployments\n[Streamlit-LEARNING - Sharing for Streamlit](https://demo-st-learning-sahil.streamlit.app/)\n\n# Show me\n![Streamlit-LEARNING-iamge](demo.jpg)\n\n---\n\n# All content\n\n## All commands\n\n```python\n# All Magic commands simplicitly `st.write()`\n''' _This_ is some __Markdown__ '''\na=3\n'dataframe:', data\n```\n\n\n## Display text\n\n```python\nst.text('Fixed width text')\nst.markdown('_Markdown_') # see #*\nst.caption('Balloons. Hundreds of them...')\nst.latex(r\\'\\'\\' e^{i\\pi} + 1 = 0 \\'\\'\\')\nst.write('Most objects') # df, err, func, keras!\nst.write(['st', 'is \u003c', 3]) # see *\nst.title('My title')\nst.header('My header')\nst.subheader('My sub')\nst.code('for i in range(8): foo()')\n\n# * optional kwarg unsafe_allow_html = True\n```\n\n\n## Display data\n\n```python\nst.dataframe(my_dataframe)\nst.table(data.iloc[0:10])\nst.json({'foo':'bar','fu':'ba'})\nst.metric(label=\"Temp\", value=\"273 K\", delta=\"1.2 K\")\n```\n\n\n## Display media\n\n```python\nst.image('./header.png')\nst.audio(data)\nst.video(data)\n```\n\n\n## Columns\n\n```python\ncol1, col2 = st.columns(2)\ncol1.write('Column 1')\ncol2.write('Column 2')\n\n# Three columns with different widths\ncol1, col2, col3 = st.columns([3,1,1])\n# col1 is wider\n              \n# Using 'with' notation:\n\u003e\u003e\u003e with col1:\n\u003e\u003e\u003e     st.write('This is column 1')\n```\n\n\n## Tabs\n\n```python\n# Insert containers separated into tabs:\n\u003e\u003e\u003e tab1, tab2 = st.tabs([\"Tab 1\", \"Tab2\"])\n\u003e\u003e\u003e tab1.write(\"this is tab 1\")\n\u003e\u003e\u003e tab2.write(\"this is tab 2\")\n\n# You can also use \"with\" notation:\n\u003e\u003e\u003e with tab1:\n\u003e\u003e\u003e   st.radio('Select one:', [1, 2])\n```\n\n\n## Control flow\n```python\n# Stop execution immediately:\nst.stop()\n# Rerun script immediately:\nst.experimental_rerun()\n\n# Group multiple widgets:\n\u003e\u003e\u003e with st.form(key='my_form'):\n\u003e\u003e\u003e   username = st.text_input('Username')\n\u003e\u003e\u003e   password = st.text_input('Password')\n\u003e\u003e\u003e   st.form_submit_button('Login')\n```\n\n\n## Personalize apps for users\n\n```python\n# Show different content based on the user's email address.\n\u003e\u003e\u003e if st.user.email == 'jane@email.com':\n\u003e\u003e\u003e    display_jane_content()\n\u003e\u003e\u003e elif st.user.email == 'adam@foocorp.io':\n\u003e\u003e\u003e    display_adam_content()\n\u003e\u003e\u003e else:\n\u003e\u003e\u003e    st.write(\"Please contact us to get access!\")\n```\n\n\n## Display interactive widgets\n\n```python\nst.button('Hit me')\nst.data_editor('Edit data', data)\nst.checkbox('Check me out')\nst.radio('Pick one:', ['nose','ear'])\nst.selectbox('Select', [1,2,3])\nst.multiselect('Multiselect', [1,2,3])\nst.slider('Slide me', min_value=0, max_value=10)\nst.select_slider('Slide to select', options=[1,'2'])\nst.text_input('Enter some text')\nst.number_input('Enter a number')\nst.text_area('Area for textual entry')\nst.date_input('Date input')\nst.time_input('Time entry')\nst.file_uploader('File uploader')\nst.download_button('On the dl', data)\nst.camera_input(\"一二三,茄子!\")\nst.color_picker('Pick a color')\n\n# Use widgets\\' returned values in variables\n\u003e\u003e\u003e for i in range(int(st.number_input('Num:'))): foo()\n\u003e\u003e\u003e if st.sidebar.selectbox('I:',['f']) == 'f': b()\n\u003e\u003e\u003e my_slider_val = st.slider('Quinn Mallory', 1, 88)\n\u003e\u003e\u003e st.write(slider_val)\n\n# Disable widgets to remove interactivity:\n\u003e\u003e\u003e st.slider('Pick a number', 0, 100, disabled=True)\n```\n\n\n## Build chat-based apps\n\n```python\n# Insert a chat message container.\n\u003e\u003e\u003e with st.chat_message(\"user\"):\n\u003e\u003e\u003e    st.write(\"Hello 👋\")\n\u003e\u003e\u003e    st.line_chart(np.random.randn(30, 3))\n\n# Display a chat input widget.\n\u003e\u003e\u003e st.chat_input(\"Say something\")  \n```\n\n## Mutate data\n\n```python\n# Add rows to a dataframe after showing it.\n\u003e\u003e\u003e element = st.dataframe(df1)\n\u003e\u003e\u003e element.add_rows(df2)\n\n# Add rows to a chart after showing it.\n\u003e\u003e\u003e element = st.line_chart(df1)\n\u003e\u003e\u003e element.add_rows(df2)\n```\n\n## Display code\n\n```python\nst.echo()\n\u003e\u003e\u003e with st.echo():\n\u003e\u003e\u003e     st.write('Code will be executed and printed')\n```\n\n\n## Placeholders, help, and options\n\n```python\n# Replace any single element.\n\u003e\u003e\u003e element = st.empty()\n\u003e\u003e\u003e element.line_chart(...)\n\u003e\u003e\u003e element.text_input(...)  # Replaces previous.\n\n# Insert out of order.\n\u003e\u003e\u003e elements = st.container()\n\u003e\u003e\u003e elements.line_chart(...)\n\u003e\u003e\u003e st.write(\"Hello\")\n\u003e\u003e\u003e elements.text_input(...)  # Appears above \"Hello\".\n\nst.help(pandas.DataFrame)\nst.get_option(key)\nst.set_option(key, value)\nst.set_page_config(layout='wide')\nst.experimental_show(objects)\nst.experimental_get_query_params()\nst.experimental_set_query_params(**params)\n```\n\n\n## Connect to data sources\n\n```python\nst.experimental_connection('pets_db', type='sql')\nconn = st.experimental_connection('sql')\nconn = st.experimental_connection('snowpark')\n\n\u003e\u003e\u003e class MyConnection(ExperimentalBaseConnection[myconn.MyConnection]):\n\u003e\u003e\u003e    def _connect(self, **kwargs) -\u003e MyConnection:\n\u003e\u003e\u003e        return myconn.connect(**self._secrets, **kwargs)\n\u003e\u003e\u003e    def query(self, query):\n\u003e\u003e\u003e       return self._instance.query(query)\n```\n\n\n## Optimize performance\n\n### Cache data objects\n\n```python\n# E.g. Dataframe computation, storing downloaded data, etc.\n\u003e\u003e\u003e @st.cache_data\n... def foo(bar):\n...   # Do something expensive and return data\n...   return data\n# Executes foo\n\u003e\u003e\u003e d1 = foo(ref1)\n# Does not execute foo\n# Returns cached item by value, d1 == d2\n\u003e\u003e\u003e d2 = foo(ref1)\n# Different arg, so function foo executes\n\u003e\u003e\u003e d3 = foo(ref2)\n# Clear all cached entries for this function\n\u003e\u003e\u003e foo.clear()\n# Clear values from *all* in-memory or on-disk cached functions\n\u003e\u003e\u003e st.cache_data.clear()\n```\n\n### Cache global resources\n\n```python\n# E.g. TensorFlow session, database connection, etc.\n\u003e\u003e\u003e @st.cache_resource\n... def foo(bar):\n...   # Create and return a non-data object\n...   return session\n# Executes foo\n\u003e\u003e\u003e s1 = foo(ref1)\n# Does not execute foo\n# Returns cached item by reference, s1 == s2\n\u003e\u003e\u003e s2 = foo(ref1)\n# Different arg, so function foo executes\n\u003e\u003e\u003e s3 = foo(ref2)\n# Clear all cached entries for this function\n\u003e\u003e\u003e foo.clear()\n# Clear all global resources from cache\n\u003e\u003e\u003e st.cache_resource.clear()\n```\n\n### Deprecated caching\n\n```python\n\u003e\u003e\u003e @st.cache\n... def foo(bar):\n...   # Do something expensive in here...\n...   return data\n\u003e\u003e\u003e # Executes foo\n\u003e\u003e\u003e d1 = foo(ref1)\n\u003e\u003e\u003e # Does not execute foo\n\u003e\u003e\u003e # Returns cached item by reference, d1 == d2\n\u003e\u003e\u003e d2 = foo(ref1)\n\u003e\u003e\u003e # Different arg, so function foo executes\n\u003e\u003e\u003e d3 = foo(ref2)\n```\n\n## Display progress and status\n\n```python\n# Show a spinner during a process\n\u003e\u003e\u003e with st.spinner(text='In progress'):\n\u003e\u003e\u003e   time.sleep(3)\n\u003e\u003e\u003e   st.success('Done')\n\n# Show and update progress bar\n\u003e\u003e\u003e bar = st.progress(50)\n\u003e\u003e\u003e time.sleep(3)\n\u003e\u003e\u003e bar.progress(100)\n\nst.balloons()\nst.snow()\nst.toast('Mr Stay-Puft')\nst.error('Error message')\nst.warning('Warning message')\nst.info('Info message')\nst.success('Success message')\nst.exception(e)\n```\n\n### Other key parts of the API\n\u003csmall\u003e[State API](https://docs.streamlit.io/en/stable/session_state_api.html)\u003c/small\u003e\u003cbr\u003e\n\u003csmall\u003e[Theme option reference](https://docs.streamlit.io/en/stable/theme_options.html)\u003c/small\u003e\u003cbr\u003e\n\u003csmall\u003e[Components API reference](https://docs.streamlit.io/en/stable/develop_streamlit_components.html)\u003c/small\u003e\u003cbr\u003e\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahilkumardhala%2Fstreamlit-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsahilkumardhala%2Fstreamlit-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahilkumardhala%2Fstreamlit-learning/lists"}