The following Japanese translation. https://docs.streamlit.io/en/latest/main_concepts.html
streamlit run your_script.py [-- script args]
As soon as you run the script as above, the local Streamlit server will start and the app will open in a new tab in your default web browser. The app is your canvas, where you draw charts, text, widgets, tables and more.
What you draw in the app is up to you. For example, st.text writes raw text to the app and st.line_chart draws a line chart. See the API documentation for all available commands.
Save the source file each time you update the app. Once saved, Streamlit will detect if there are any changes and ask if you want to rerun the app. If you select "Always Rerun" at the top right of the screen, the app will be updated automatically every time you change the source code.
Streamlit's architecture allows you to write apps in the same way you write plain Python scripts. Whenever you need to update something on your screen, Streamlit reruns your entire Python script from top to bottom.
This can happen in two situations.
--When you change the source code of the app. --When the user interacts with the widget in the app.
There are several ways to view data (tables, arrays, data frames) in the Streamlit app. First, I introduced you to magic and st.write (), which can write anything from text to tables. Now let's take a look at the methods designed to visualize the data.
Why not always use st.write ()? There are several reasons.
Magic and st.write () inspect the type of data passed and determine how your app renders it best. You may want to draw in a different way. For example, instead of drawing a data frame as an interactive table, you may want to use st.table (df) to draw it as a static table.
The second reason is that other methods return objects that you can use or modify by adding or replacing data.
Finally, if you use the more specialized Streamlit method, you can pass additional arguments to customize the behavior.
For example, let's create a data frame and format it with a Pandas Styler object. This example uses Numpy to generate a random sample and the st.dataframe () method to draw an interactive table.
Recommended Posts