Create a website that prints 'Hi' and 'Hello' on two separate lines, using Shiny for Python

35 views Asked by At

This is a simplification of my general problem, so I would like to stick to the rubric given in the example. Packages like htmltools are welcome, although I have already tried a few "solutions" using this, given by ChatGPT. I am generally running a neural network inside of app(), and I want the output to look something like

The result from neural network X is: 137

The result from neural network Y is: 17

Here is my code

from shiny.express import render

@render.text()
def app():
    return 'Hi \n Hello'

When I run shiny run --reload shinyfoo.py in the terminal, I receive the URL for the resulting website, but unfortunately the website simply yields

Hi Hello

I have also tried using the htmltools package and using <br> instead of \n, but this doesn't work either. I do not know R, so I would like to stick with Python for this problem. Unfortunately, all similar posts I have seen seem to use R.

0

There are 0 answers