In page Console / Print

I am wondering if there is a way I can either re-direct stdout into the page, or alternatively have a way that i can create a textarea or iframe type widget where console type messages get printed.

My example is I am using fastai but the progress bar either outputs a jupyter widget or prints to the console. I have figured out I can override the print function with st.write but its a big ugly having that just getting dumped in the page.

for example:

import streamlit as st
import fastprogress

def log_fastai_msg(to_write, end=None, **kwargs):
    """log progress message from fastai"""
    if end:

fastprogress.fastprogress.WRITER_FN = log_fastai_msg

Does anyone have any other ways I can allow streamlit to support the ipython widgets or control the output of logged text in a nicer way?


+1 I’d like this type of functionality to easily port code written as Jupyter notebook or Python script

+1 as well

+1 really useful to use Streamlit as a frontend for CLIs

Hello :wave:

I’ve made a small prototype which redirects any stdout or stderr message to a streamlit widget in realtime: Cannot print the terminal output in Streamlit?

As for ipywidgets, they’re not supported yet. Hopefully in the future they’ll be. Here’s the associated topic for more info: Ipywidgets (WIP)