wandb / openui

OpenUI let's you describe UI using your imagination, then see it rendered live.
https://openui.fly.dev
Apache License 2.0
16.86k stars 1.47k forks source link

Can OpenUI program pyscript in UI? #77

Closed cosmosanalytics closed 1 month ago

cosmosanalytics commented 1 month ago

Pyscript brings python into frontend, I am wondering if OpenUI can code pyscript in UI? If yes, can you give me an example?

vanpelt commented 1 month ago

It's able to do JavaScript if you ask it to. For pyscript to work we would need to bootstrap the interpreter like we do with tailwind. Possible but not something I'm planning on.

I'm curious, why do you want to run pyscript instead of JavaScript?

cosmosanalytics commented 1 month ago

Because pyscript completely replaces the backend. see the demos at https://pyscript.net/examples/.

JavaScript can only do frontend with node js (or python) at the backend.

If I can use pyscript in OpenUI, I would just need one static web page, everything will be run in the browser.

cosmosanalytics commented 1 month ago

I can use gemini ai to write pyscript in html, so LLM is capable of writing pyscript in html as well as javascript.

I am a python data scientist, using streamlit to present my analytics, being able to write pyscript in html will save me time to setup the backend.

cosmosanalytics commented 1 month ago

See pyscript example to do chatgpt at the frontend https://pyscript.com/@adec3dd4-c366-46d3-9d45-84d3b0996a43/07a0de9f-afd1-4975-a65d-17dfb3bf7b4e/latest

cosmosanalytics commented 1 month ago

here is a screenshot of gemini ai generating pyscript in html image

vanpelt commented 1 month ago

The problem is you really don't want to put your api key into the frontend... also, there's nothing specific about Python in this project. It could all be JavaScript. I just preferred Python for the backend.

vanpelt commented 1 month ago

I added an option to convert an HTML component into a Streamlit app which could be useful.