• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Crypto Currency
  • Technology
  • Contact
NEO Share

NEO Share

Sharing The Latest Tech News

  • Home
  • Artificial Intelligence
  • Machine Learning
  • Computers
  • Mobile
  • Crypto Currency

8 Simple and Useful Streamlit Tricks You Should Know

February 10, 2021 by systems

1. Display Source Code to Provide a Context

When you’re displaying data to your peers who are interested in viewing your code, it’s useful to show your code in the web app. To do this, you can use the code widget, which supports Python, JavaScript, SQL, Java, Ruby, and many other common languages.

Display Code Blocks

It’s often useful to show the code that is directly responsible for the widget or its related data. The trick is to use the echo function, as shown below.

with st.echo():
fruits = ['apple', 'banana']
http_response = (404, 'Page Not Found')
st.radio("Choose Fruit", fruits)
st.text_input("HTTP Responses", http_response)

The following figure shows you what you’ll see on the screen. In essence, everything in the with statement will be included in a code block.

Using echo()

Filed Under: Artificial Intelligence

Primary Sidebar

Stay Ahead: The Latest Tech News and Innovations

Cryptocurrency Market Updates: What’s Happening Now

Emerging Trends in Artificial Intelligence: What to Watch For

Top Cloud Computing Services to Secure Your Data

The Future of Mobile Technology: Recent Advancements and Predictions

Footer

  • Privacy Policy
  • Terms and Conditions

Copyright © 2025 NEO Share

Terms and Conditions - Privacy Policy