TexteaInc / funix

Building web apps without manually creating widgets
http://funix.io
MIT License
99 stars 11 forks source link

Support for HoloViz Panel #85

Open ahuang11 opened 4 months ago

ahuang11 commented 4 months ago

Hi! Love the idea of using typing to create widgets (Panel sort of already does this, but not with native Python types).

I'd love to get Panel working with this!

Copying the example from homepage and replacing ipywidgets with Panel:

import typing # Python native 

import panel as pn  # popular UI library 

def input_widgets_basic(
    prompt: str = "Who is Oppenheimer?",
    advanced_features: bool = True,
    model: typing.Literal['GPT-3.5', 'GPT-4.0', 'Falcon-7B'] = 'GPT-4.0',
    max_token: range(100, 200, 20) = 140,
    openai_key: pn.widgets.PasswordInput = "1234556",
    )  -> str:
    pass

input_widgets_basic()

I get this

image

Instead of:

image
ahuang11 commented 4 months ago

After talking to Forrest, I think param is probably more suitable since funix is mapping types to widgets, rather than using ipywidgets widgets.

However, maybe Panel can be used as a separate backend.