acecalisto3/PhiCo-D-Instruck
Text Generation • Updated • 35 • 2
id stringlengths 14 15 | text stringlengths 273 1.89k | source stringclasses 1
value |
|---|---|---|
e4409cd96e13-0 | search
Search
⌘K
dark_mode
light_mode
menu
Home/
Streamlit library/
Get started/
Main concepts
Main concepts
Working with Streamlit is simple. First you sprinkle a few Streamlit commands into a normal Python script, then you run it with streamlit run:
streamlit run your_script.py [-- script args]
Copy
As soon as ... | streamlit-docs.txt |
e4409cd96e13-1 | Every time you want to update your app, save the source file. When you do that, Streamlit detects if there is a change and asks you whether you want to rerun your app. Choose "Always rerun" at the top-right of your screen to automatically update your app every time you change its source code.
This allows you to work i... | streamlit-docs.txt |
e4409cd96e13-2 | This can happen in two situations:
Whenever you modify your app's source code.
Whenever a user interacts with widgets in the app. For example, when dragging a slider, entering text in an input box, or clicking a button.
Whenever a callback is passed to a widget via the on_change (or on_click) parameter, the callback... | streamlit-docs.txt |
e4409cd96e13-3 | Write a data frame
Along with magic commands, st.write() is Streamlit's "Swiss Army knife". You can pass almost anything to st.write(): text, data, Matplotlib figures, Altair charts, and more. Don't worry, Streamlit will figure it out and render things the right way.
import streamlit as st
import pandas as pd
st.wri... | streamlit-docs.txt |
e4409cd96e13-4 | push_pin
Note
This example uses Numpy to generate a random sample, but you can use Pandas DataFrames, Numpy arrays, or plain Python arrays.
import streamlit as st
import numpy as np
dataframe = np.random.randn(10, 20)
st.dataframe(dataframe)
Copy
Let's expand on the first example using the Pandas Styler object to h... | streamlit-docs.txt |
e4409cd96e13-5 | import streamlit as st
import numpy as np
import pandas as pd
map_data = pd.DataFrame(
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
columns=['lat', 'lon'])
st.map(map_data)
Copy
Widgets
When you've got the data or model into the state that you want to explore, you can add in widgets like st.slider(... | streamlit-docs.txt |
e4409cd96e13-6 | Use checkboxes to show/hide data
One use case for checkboxes is to hide or show a specific chart or section in an app. st.checkbox() takes a single argument, which is the widget label. In this sample, the checkbox is used to toggle a conditional statement.
import streamlit as st
import numpy as np
import pandas as pd... | streamlit-docs.txt |
e4409cd96e13-7 | # Add a slider to the sidebar:
add_slider = st.sidebar.slider(
'Select a range of values',
0.0, 100.0, (25.0, 75.0)
)
Copy
Beyond the sidebar, Streamlit offers several other ways to control the layout of your app. st.columns lets you place widgets side-by-side, and st.expander lets you conserve space by hiding... | streamlit-docs.txt |
e4409cd96e13-8 | '...and now we\'re done!'
Copy
Themes
Streamlit supports Light and Dark themes out of the box. Streamlit will first check if the user viewing an app has a Light or Dark mode preference set by their operating system and browser. If so, then that preference will be used. Otherwise, the Light theme is applied by default.... | streamlit-docs.txt |
e4409cd96e13-9 | To cache a function in Streamlit, you need to decorate it with one of two decorators (st.cache_data and st.cache_resource):
@st.cache_data
def long_running_function(param1, param2):
return …
Copy
In this example, decorating long_running_function with @st.cache_data tells Streamlit that whenever the function is ca... | streamlit-docs.txt |
e4409cd96e13-10 | Streamlit's two caching decorators and their use cases.
For more information about the Streamlit caching decorators, their configuration parameters, and their limitations, see Caching.
Pages
As apps grow large, it becomes useful to organize them into multiple pages. This makes the app easier to manage as a developer... | streamlit-docs.txt |
e4409cd96e13-11 | App model
Now that you know a little more about all the individual pieces, let's close the loop and review how it works together:
Streamlit apps are Python scripts that run from top to bottom
Every time a user opens a browser tab pointing to your app, the script is re-executed
As the script executes, Streamlit draws ... | streamlit-docs.txt |
e4409cd96e13-12 | The easiest way to learn how to use Streamlit is to try things out yourself. As you read through this guide, test each method. As long as your app is running, every time you add a new element to your script and save, Streamlit's UI will ask if you'd like to rerun the app and view the changes. This allows you to work in... | streamlit-docs.txt |
e4409cd96e13-13 | st.title('Uber pickups in NYC')
Copy
Now it's time to run Streamlit from the command line:
streamlit run uber_pickups.py
Copy
Running a Streamlit app is no different than any other Python script. Whenever you need to view the app, you can use this command.
star
Tip
Did you know you can also pass a URL to streamlit... | streamlit-docs.txt |
e4409cd96e13-14 | Now let's test the function and review the output. Below your function, add these lines:
# Create a text element and let the reader know the data is loading.
data_load_state = st.text('Loading data...')
# Load 10,000 rows of data into the dataframe.
data = load_data(10000)
# Notify the reader that the data was success... | streamlit-docs.txt |
e4409cd96e13-15 | Let's take a few minutes to discuss how @st.cache_data actually works.
When you mark a function with Streamlit’s cache annotation, it tells Streamlit that whenever the function is called that it should check two things:
The input parameters you used for the function call.
The code inside the function.
If this is the... | streamlit-docs.txt |
e4409cd96e13-16 | Now that you know how caching with Streamlit works, let’s get back to the Uber pickup data.
Inspect the raw data
It's always a good idea to take a look at the raw data you're working with before you start working with it. Let's add a subheader and a printout of the raw data to the app:
st.subheader('Raw data')
st.wr... | streamlit-docs.txt |
e4409cd96e13-17 | To draw this diagram we used Streamlit's native bar_chart() method, but it's important to know that Streamlit supports more complex charting libraries like Altair, Bokeh, Plotly, Matplotlib and more. For a full list, see supported charting libraries.
Plot data on a map
Using a histogram with Uber's dataset helped us ... | streamlit-docs.txt |
e4409cd96e13-18 | Filter results with a slider
In the last section, when you drew the map, the time used to filter results was hardcoded into the script, but what if we wanted to let a reader dynamically filter the data in real time? Using Streamlit's widgets you can. Let's add a slider to the app with the st.slider() method.
Locate h... | streamlit-docs.txt |
e4409cd96e13-19 | st.title('Uber pickups in NYC')
DATE_COLUMN = 'date/time'
DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
@st.cache_data
def load_data(nrows):
data = pd.read_csv(DATA_URL, nrows=nrows)
lowercase = lambda x: str(x).lower()
data.rename(lowercas... | streamlit-docs.txt |
e4409cd96e13-20 | That's it! 🎈 You now have a publicly deployed app that you can share with the world. Click to learn more about how to use Streamlit Community Cloud.
Get help
That's it for getting started, now you can go and build your own apps! If you run into difficulties here are a few things you can do.
Check out our community ... | streamlit-docs.txt |
e4409cd96e13-21 | Navigate to the upload section of your new bucket:
And upload the following CSV file, which contains some example data:
myfile.csv
Enable the Google Cloud Storage API
The Google Cloud Storage API is enabled by default when you create a project through the Google Cloud Console or CLI. Feel free to skip to the next st... | streamlit-docs.txt |
e4409cd96e13-22 | # .streamlit/secrets.toml
[gcp_service_account]
type = "service_account"
project_id = "xxx"
private_key_id = "xxx"
private_key = "xxx"
client_email = "xxx"
client_id = "xxx"
auth_uri = "https://accounts.google.com/o/oauth2/auth"
token_uri = "https://oauth2.googleapis.com/token"
auth_provider_x509_cert_url = "https://w... | streamlit-docs.txt |
e4409cd96e13-23 | # Retrieve file contents.
# Uses st.cache_data to only rerun when the query changes or after 10 min.
@st.cache_data(ttl=600)
def read_file(bucket_name, file_path):
bucket = client.bucket(bucket_name)
content = bucket.blob(file_path).download_as_string().decode("utf-8")
return content
bucket_name = "streaml... | streamlit-docs.txt |
e4409cd96e13-24 | This is a summary of the docs, as of Streamlit v1.20.0.
Install & Import
streamlit run first_app.py
# Import convention
>>> import streamlit as st
Command line
streamlit --help
streamlit run your_script.py
streamlit hello
streamlit config show
streamlit cache clear
streamlit docs
streamlit --version
Pre-release featu... | streamlit-docs.txt |
e4409cd96e13-25 | # Or use "with" notation:
>>> with st.sidebar:
>>> st.radio('Select one:', [1, 2])
Columns
# Two equal columns:
>>> col1, col2 = st.columns(2)
>>> col1.write("This is column 1")
>>> col2.write("This is column 2")
# Three different columns:
>>> col1, col2, col3 = st.columns([3, 1, 1])
# col1 is larger.
# You can als... | streamlit-docs.txt |
e4409cd96e13-26 | # Group multiple widgets:
>>> with st.form(key='my_form'):
>>> username = st.text_input('Username')
>>> password = st.text_input('Password')
>>> st.form_submit_button('Login')
Display interactive widgets
st.button('Click me')
st.experimental_data_editor('Edit data', data)
st.checkbox('I agree')
st.radio('Pick one... | streamlit-docs.txt |
e4409cd96e13-27 | # Add rows to a chart after
# showing it.
>>> element = st.line_chart(df1)
>>> element.add_rows(df2)
Display code
>>> with st.echo():
>>> st.write('Code will be executed and printed')
Placeholders, help, and options
# Replace any single element.
>>> element = st.empty()
>>> element.line_chart(...)
>>> element.text_in... | streamlit-docs.txt |
e4409cd96e13-28 | st.help(pandas.DataFrame)
st.get_option(key)
st.set_option(key, value)
st.set_page_config(layout='wide')
st.experimental_show(objects)
st.experimental_get_query_params()
st.experimental_set_query_params(**params)
Optimize performance
Cache data objects
# E.g. Dataframe computation, storing downloaded data, etc.
>>> @st... | streamlit-docs.txt |
e4409cd96e13-29 | >>> # Does not execute foo
>>> # Returns cached item by reference, d1 == d2
>>> d2 = foo(ref1)
>>> # Different arg, so function foo executes
>>> d3 = foo(ref2)
Display progress and status
>>> with st.spinner(text='In progress'):
>>> time.sleep(5)
>>> st.success('Done') | streamlit-docs.txt |
e4409cd96e13-30 | st.progress(progress_variable_1_to_100)
st.balloons()
st.snow()
st.error('Error message')
st.warning('Warning message')
st.info('Info message')
st.success('Success message')
st.exception(e)
Personalize apps for users
# Show different content based on the user's email address.
>>> if st.user.email == 'jane@email.com':
>... | streamlit-docs.txt |
e4409cd96e13-31 | In this guide, we will illustrate the usage of Session State and Callbacks as we build a stateful Counter app.
For details on the Session State and Callbacks API, please refer to our Session State API Reference Guide.
Also, check out this Session State basics tutorial video by Streamlit Developer Advocate Dr. Marisa ... | streamlit-docs.txt |
e4409cd96e13-32 | Read the value of an item in Session State by passing the item to st.write :
import streamlit as st
if 'key' not in st.session_state:
st.session_state['key'] = 'value'
# Reads
st.write(st.session_state.key)
# Outputs: value
Copy
Update an item in Session State by assigning it a value:
import streamlit as st
... | streamlit-docs.txt |
e4409cd96e13-33 | Callbacks: A callback is a Python function which gets called when an input widget changes. Callbacks can be used with widgets using the parameters on_change (or on_click), args, and kwargs. The full Callbacks API can be found in our Session State API Reference Guide.
import streamlit as st
st.title('Counter Example u... | streamlit-docs.txt |
e4409cd96e13-34 | st.button('Increment', on_click=increment_counter,
kwargs=dict(increment_value=5))
st.button('Decrement', on_click=decrement_counter,
kwargs=dict(decrement_value=1))
st.write('Count = ', st.session_state.count)
Copy
Example 4: Forms and Callbacks
Say we now want to not only increment the count, but also stor... | streamlit-docs.txt |
e4409cd96e13-35 | We illustrate this with the following example. Let's say we have an app with a slider to represent temperature in Celsius. We can set and get the value of the temperature widget by using the Session State API, as follows:
import streamlit as st
if "celsius" not in st.session_state:
# set the initial default value... | streamlit-docs.txt |
e4409cd96e13-36 | Our forums are full of helpful information and Streamlit experts.
Previous:
Experimental cache primitives
Next:
Dataframes
Home
Contact Us
Community
Copyright © 2023, Streamlit Inc.
Add statefulness to apps - Streamlit Docssearch
Search
⌘K
dark_mode
light_mode
description
Streamlit library
cloud
Streamlit Comm... | streamlit-docs.txt |
e4409cd96e13-37 | st.dataframe also provides some additional functionality by using glide-data-grid under the hood:
Column sorting: sort columns by clicking on their headers.
Column resizing: resize columns by dragging and dropping column header borders.
Table resizing: resize tables by dragging and dropping the bottom right corner.
Se... | streamlit-docs.txt |
e4409cd96e13-38 | df = load_data()
edited_df = st.experimental_data_editor(df) # 👈 An editable dataframe
favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]
st.markdown(f"Your favorite command is **{favorite_command}** 🎈")
Copy
View interactive app
expand_more
Try it out by double-clicking on any cell. You'll n... | streamlit-docs.txt |
e4409cd96e13-39 | Did you notice that although the initial dataframe had just five rows, pasting all those rows from the spreadsheet added additional rows to the dataframe? 👀 Let's find out how that works in the next section.
Add and delete rows
With st.experimental_data_editor, viewers can add or delete rows via the table UI. This m... | streamlit-docs.txt |
e4409cd96e13-40 | This can be useful when working with large dataframes and you only need to know which cells have changed, rather than the entire edited dataframe.
View interactive app
expand_more
Use all we've learned so far and apply them to the above embedded app. Try editing cells, adding new rows, and deleting rows.
Notice how ... | streamlit-docs.txt |
e4409cd96e13-41 | Edit common data structures
Editing doesn't just work for Pandas DataFrames! You can also edit lists, tuples, sets, dictionaries, NumPy arrays, or Snowpark & PySpark DataFrames. Most data types will be returned in their original format. But some types (e.g. Snowpark and PySpark) are converted to Pandas DataFrames. To ... | streamlit-docs.txt |
e4409cd96e13-42 | While the ability to configure columns has yet to be released, there are techniques you can use with Pandas today to render columns as checkboxes, selectboxes, and change the type of columns.
Boolean columns (checkboxes)
To render columns as checkboxes and clickable checkboxes in st.dataframe and st.experimental_data... | streamlit-docs.txt |
e4409cd96e13-43 | edited_df = st.experimental_data_editor(df)
Copy
In some cases, you may want users to select categories that aren’t in the original Pandas DataFrame. Let’s say we use df from above. Currently, the command column can take on four unique values. What should we do if we want users to see additional options such as st.but... | streamlit-docs.txt |
e4409cd96e13-44 | Handling large datasets
st.dataframe and st.experimental_data_editor have been designed to theoretically handle tables with millions of rows thanks to their highly performant implementation using the glide-data-grid library and HTML canvas. However, the maximum amount of data that an app can realistically handle will ... | streamlit-docs.txt |
e4409cd96e13-45 | The editing functionalities are not yet optimized for mobile devices.
Editing is enabled only for a limited set of types (e.g. string, numbers, boolean). We are actively working on supporting more types soon, such as date, time, and datetime.
Editing of Pandas DataFrames only supports the following index types: RangeIn... | streamlit-docs.txt |
e4409cd96e13-46 | Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
API reference/
Status elements/
st.progress
st.progress
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5.0
v1.4.0
v1.3.0
v1.2.0
... | streamlit-docs.txt |
e4409cd96e13-47 | This also supports:
Emoji shortcodes, such as :+1: and :sunglasses:. For a list of all supported codes, see https://share.streamlit.io/streamlit/emoji-shortcodes.
LaTeX expressions, by wrapping them in "$" or "$$" (the "$$" must be on their own lines). Supported LaTeX functions are listed at https://katex.org/docs/sup... | streamlit-docs.txt |
e4409cd96e13-48 | Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
API reference/
Write and magic/
st.write
st.write
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5.0
v1.4.0
v1.3.0
v1.2.0
v1.1.0... | streamlit-docs.txt |
e4409cd96e13-49 | One or many objects to print to the App.
Arguments are handled as follows:
write(string) : Prints the formatted Markdown string, with
support for LaTeX expression, emoji shortcodes, and colored text. See docs for st.markdown for more.
write(data_frame) : Displays the DataFrame as a table.
write(error) : Prints an exc... | streamlit-docs.txt |
e4409cd96e13-50 | import streamlit as st
import pandas as pd
st.write(1234)
st.write(pd.DataFrame({
'first column': [1, 2, 3, 4],
'second column': [10, 20, 30, 40],
}))
Copy
(view standalone Streamlit app)
Finally, you can pass in multiple arguments to do things like:
import streamlit as st
st.write('1 + 1 = ', 2)
st.write('... | streamlit-docs.txt |
e4409cd96e13-51 | Knowledge base
Home/
Streamlit library/
API reference/
Write and magic/
magic
Magic
Magic commands are a feature in Streamlit that allows you to write almost anything (markdown, data, charts) without having to type an explicit command at all. Just put the thing you want to show on its own line of code, and it will ap... | streamlit-docs.txt |
e4409cd96e13-52 | Was this page helpful?
thumb_up
Yes
thumb_down
No
edit
Suggest edits
forum
Still have questions?
Our forums are full of helpful information and Streamlit experts.
Previous:
st.write
Next:
Text elements
Home
Contact Us
Community
Copyright © 2023, Streamlit Inc.
Magic - Streamlit Docssearch
Search
⌘K
dark_mode
li... | streamlit-docs.txt |
e4409cd96e13-53 | This also supports:
Emoji shortcodes, such as :+1: and :sunglasses:. For a list of all supported codes, see https://share.streamlit.io/streamlit/emoji-shortcodes.
LaTeX expressions, by wrapping them in "$" or "$$" (the "$$" must be on their own lines). Supported LaTeX functions are listed at https://katex.org/docs/sup... | streamlit-docs.txt |
e4409cd96e13-54 | dark_mode
light_mode
description
Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
API reference/
Text elements/
st.code
st.code
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5... | streamlit-docs.txt |
e4409cd96e13-55 | Was this page helpful?
thumb_up
Yes
thumb_down
No
edit
Suggest edits
forum
Still have questions?
Our forums are full of helpful information and Streamlit experts.
Previous:
st.caption
Next:
st.text
Home
Contact Us
Community
Copyright © 2023, Streamlit Inc.
st.code - Streamlit Docssearch
Search
⌘K
dark_mode
ligh... | streamlit-docs.txt |
e4409cd96e13-56 | Parameters
label (str)
A short label explaining to the user what this button is for. The label can optionally contain Markdown and supports the following elements: Bold, Italics, Strikethroughs, and Emojis.
Unsupported elements are not displayed. Display unsupported elements as literal characters by backslash-escapi... | streamlit-docs.txt |
e4409cd96e13-57 | Check out our video on how to use one of Streamlit's core functions, the button!
In the video below, we'll take it a step further and learn how to combine a button, checkbox and radio button!
Was this page helpful?
thumb_up
Yes
thumb_down
No
edit
Suggest edits
forum
Still have questions?
Our forums are full of help... | streamlit-docs.txt |
e4409cd96e13-58 | st.experimental_data_editor
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5.0
v1.4.0
v1.3.0
v1.2.0
v1.1.0
v1.0.0
v0.89.0
v0.88.0
v0.87.0
v0.86.0
v0.85.0
v0.84.0
v0.83.0
Display a data editor widget.
Display a data editor widget... | streamlit-docs.txt |
e4409cd96e13-59 | use_container_width (bool)
If True, set the data editor width to the width of the parent container. This takes precedence over the width argument. Defaults to False.
num_rows ("fixed" or "dynamic")
Specifies if the user can add and delete rows in the data editor. If "fixed", the user cannot add or delete rows. If "d... | streamlit-docs.txt |
e4409cd96e13-60 | favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]
st.markdown(f"Your favorite command is **{favorite_command}** 🎈")
Copy
(view standalone Streamlit app)
You can also allow the user to add and delete rows by setting num_rows to "dynamic":
import streamlit as st
import pandas as pd
df = pd.Dat... | streamlit-docs.txt |
e4409cd96e13-61 | Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
API reference/
Input widgets/
st.download_button
st.download_button
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5.0
v1.4.0
v1... | streamlit-docs.txt |
e4409cd96e13-62 | Unsupported elements are not displayed. Display unsupported elements as literal characters by backslash-escaping them. E.g. 1\. Not an ordered list.
data (str or bytes or file)
The contents of the file to be downloaded. See example below for caching techniques to avoid recomputing this data unnecessarily.
file_name ... | streamlit-docs.txt |
e4409cd96e13-63 | Examples
Download a large DataFrame as a CSV:
import streamlit as st
@st.cache
def convert_df(df):
# IMPORTANT: Cache the conversion to prevent computation on every rerun
return df.to_csv().encode('utf-8')
csv = convert_df(my_large_df)
st.download_button(
label="Download data as CSV",
data=csv,
... | streamlit-docs.txt |
e4409cd96e13-64 | Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
API reference/
Input widgets/
st.text_input
st.text_input
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5.0
v1.4.0
v1.3.0
v1.2.... | streamlit-docs.txt |
e4409cd96e13-65 | This also supports:
Emoji shortcodes, such as :+1: and :sunglasses:. For a list of all supported codes, see https://share.streamlit.io/streamlit/emoji-shortcodes.
LaTeX expressions, by wrapping them in "$" or "$$" (the "$$" must be on their own lines). Supported LaTeX functions are listed at https://katex.org/docs/sup... | streamlit-docs.txt |
e4409cd96e13-66 | An optional tooltip that gets displayed next to the input.
autocomplete (str)
An optional value that will be passed to the <input> element's autocomplete property. If unspecified, this value will be set to "new-password" for "password" inputs, and the empty string for "default" inputs. For more details, see https://d... | streamlit-docs.txt |
e4409cd96e13-67 | Text input widgets can customize how to hide their labels with the label_visibility parameter. If "hidden", the label doesn’t show but there is still empty space for it above the widget (equivalent to label=""). If "collapsed", both the label and the space are removed. Default is "visible". Text input widgets can also ... | streamlit-docs.txt |
e4409cd96e13-68 | Search
⌘K
dark_mode
light_mode
description
Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
API reference/
Input widgets/
st.file_uploader
st.file_uploader
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1... | streamlit-docs.txt |
e4409cd96e13-69 | Parameters
label (str)
A short label explaining to the user what this file uploader is for. The label can optionally contain Markdown and supports the following elements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.
This also supports:
Emoji shortcodes, such as :+1: and :sunglasses:. For a list of... | streamlit-docs.txt |
e4409cd96e13-70 | A tooltip that gets displayed next to the file uploader.
on_change (callable)
An optional callback invoked when this file_uploader's value changes.
args (tuple)
An optional tuple of args to pass to the callback.
kwargs (dict)
An optional dict of kwargs to pass to the callback.
disabled (bool)
An optional boolea... | streamlit-docs.txt |
e4409cd96e13-71 | # Can be used wherever a "file-like" object is accepted:
dataframe = pd.read_csv(uploaded_file)
st.write(dataframe)
Copy
Insert a file uploader that accepts multiple files at a time:
import streamlit as st
uploaded_files = st.file_uploader("Choose a CSV file", accept_multiple_files=True)
for uploaded_file in... | streamlit-docs.txt |
e4409cd96e13-72 | Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
API reference/
Input widgets/
st.selectbox
st.selectbox
Streamlit Version
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5.0
v1.4.0
v1.3.0
v1.2.0
... | streamlit-docs.txt |
e4409cd96e13-73 | This also supports:
Emoji shortcodes, such as :+1: and :sunglasses:. For a list of all supported codes, see https://share.streamlit.io/streamlit/emoji-shortcodes.
LaTeX expressions, by wrapping them in "$" or "$$" (the "$$" must be on their own lines). Supported LaTeX functions are listed at https://katex.org/docs/sup... | streamlit-docs.txt |
e4409cd96e13-74 | An optional tuple of args to pass to the callback.
kwargs (dict)
An optional dict of kwargs to pass to the callback.
disabled (bool)
An optional boolean, which disables the selectbox if set to True. The default is False. This argument can only be supplied by keyword.
label_visibility ("visible" or "hidden" or "col... | streamlit-docs.txt |
e4409cd96e13-75 | with col2:
option = st.selectbox(
"How would you like to be contacted?",
("Email", "Home phone", "Mobile phone"),
label_visibility=st.session_state.visibility,
disabled=st.session_state.disabled,
)
Copy
(view standalone Streamlit app)
Was this page helpful?
thumb_up
Yes
thumb_d... | streamlit-docs.txt |
e4409cd96e13-76 | As flags on the command line when running streamlit run:
streamlit run your_script.py --server.port 80
Copy
star
Tip
To set configuration options on Streamlit Community Cloud, read Optionally, add a configuration file in the Streamlit Community Cloud docs.
Telemetry
As mentioned during the installation process, Str... | streamlit-docs.txt |
e4409cd96e13-77 | # DataFrame serialization.
# Acceptable values: - 'legacy': Serialize DataFrames using Streamlit's custom format. Slow but battle-tested. - 'arrow': Serialize DataFrames using Apache Arrow. Much faster and versatile.
# Default: "arrow"
dataFrameSerialization = "arrow"
[logger]
# Level of logging: 'error', 'warning',... | streamlit-docs.txt |
e4409cd96e13-78 | # Sets the MPLBACKEND environment variable to Agg inside Streamlit to prevent Python crashing.
# Default: true
fixMatplotlib = true
# Run the Python Garbage Collector after each script execution. This can help avoid excess memory use in Streamlit apps, but could introduce delay in rerunning the app script for high-mem... | streamlit-docs.txt |
e4409cd96e13-79 | # If false, will attempt to open a browser window on start.
# Default: false unless (1) we are on a Linux box where DISPLAY is unset, or (2) we are running in the Streamlit Atom plugin.
headless = false
# Automatically rerun script when the file is modified on disk.
# Default: false
runOnSave = false
# The address wh... | streamlit-docs.txt |
e4409cd96e13-80 | # Max size, in megabytes, of messages that can be sent via the WebSocket connection.
# Default: 200
maxMessageSize = 200
# Enables support for websocket compression.
# Default: false
enableWebsocketCompression = false
# Enable serving files from a `static` directory in the running app's directory.
# Default: false
en... | streamlit-docs.txt |
e4409cd96e13-81 | [mapbox]
# Configure Streamlit to use a custom Mapbox token for elements like st.pydeck_chart and st.map. To get a token for yourself, create an account at https://mapbox.com. It's free (for moderate usage levels)!
# Default: ""
token = ""
[deprecation]
# Set to false to disable the deprecation warning for the file... | streamlit-docs.txt |
e4409cd96e13-82 | school
Knowledge base
Home/
Streamlit library/
Advanced features/
Theming
Theming
In this guide, we provide examples of how Streamlit page elements are affected by the various theme config options. For a more high-level overview of Streamlit themes, see the Themes section of the main concepts documentation.
Streaml... | streamlit-docs.txt |
e4409cd96e13-83 | textColor
This option controls the text color for most of your Streamlit app.
font
Selects the font used in your Streamlit app. Valid values are "sans serif", "serif", and "monospace". This option defaults to "sans serif" if unset or invalid.
Note that code blocks are always rendered using the monospace font regard... | streamlit-docs.txt |
e4409cd96e13-84 | Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit library/
Advanced features/
Widget semantics
Advanced notes on widget behavior
Widgets are magical and often work how you want. But they can have surprising behavior in some situations. Here is a high-level, abstract descripti... | streamlit-docs.txt |
e4409cd96e13-85 | Streamlit library
cloud
Streamlit Community Cloud
school
Knowledge base
Home/
Streamlit Community Cloud/
Get started/
Deploy an app/
App dependencies
App dependencies
The main reason that apps fail to build properly is because Streamlit Community Cloud can't find your dependencies! So make sure you:
Add a requir... | streamlit-docs.txt |
e4409cd96e13-86 | Add apt-get dependencies to packages.txt, one package name per line. For example:
freeglut3-dev
libgtk2.0-dev
Copy
Was this page helpful?
thumb_up
Yes
thumb_down
No
edit
Suggest edits
forum
Still have questions?
Our forums are full of helpful information and Streamlit experts.
Previous:
Deploy an app
Next:
Connect... | streamlit-docs.txt |
e4409cd96e13-87 | # You can also add other sections if you like.
# The contents of sections as shown below will not become environment variables,
# but they'll be easily accessible from within Streamlit anyway as we show
# later in this doc.
[my_cool_secrets]
things_i_like = ["Streamlit", "Python"]
Copy
Use secrets in your app
Access y... | streamlit-docs.txt |
e4409cd96e13-88 | # Far more compact version!
my_db.connect(**st.secrets.db_credentials)
Copy
Edit your app's secrets
Go to https://share.streamlit.io/
Open the menu for your app, and click "Settings".
You will see a modal appear. Click on the "Secrets" section and edit your secrets.
After you edit your secrets, click "Save". It might... | streamlit-docs.txt |
No dataset card yet