Skip to content

Commit

Permalink
Music udpates
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac-Flath committed Sep 28, 2024
1 parent a4560ff commit 8915b7e
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 1,335 deletions.
482 changes: 79 additions & 403 deletions ex_app/music.py

Large diffs are not rendered by default.

87 changes: 30 additions & 57 deletions ex_app/playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,68 +19,41 @@
from fh_frankenui.components import *

# %% ../ex_nbs/07_playground.ipynb 9
preset_options = ["Grammatical Standard English"]

# , "Summarize for a 2nd grader",
# "Text to command","Q&A","English to other languages","Parse unstructured data",
# "Classification","Natural language to Python","Explain code","Chat","More examples"]
preset_options = ["Grammatical Standard English", "Summarize for a 2nd grader",
"Text to command","Q&A","English to other languages","Parse unstructured data",
"Classification","Natural language to Python","Explain code","Chat","More examples"]

# %% ../ex_nbs/07_playground.ipynb 10
# def playground_navbar():
# rnav = Div(cls='space-x-6 mr-10')(
# # preset_select,#UkSelect(*Options(*preset_options),name='preset',placeholder='Load a preset',searchable=True),
# UkDropdownButton(P("Load a preset",cls=TextT.muted_sm),
# btn_cls=UkButtonT.default,
# options=(P('Content filter preferences',cls=TextT.muted_sm), UkHSplit(),
# P('Delete preset',cls=(TextT.muted_sm,'uk-text-danger'))
# )),

# UkButton("Save", cls=UkButtonT.secondary),
# UkButton("View Code", cls=UkButtonT.secondary),
# UkButton("Share", cls=UkButtonT.secondary),
# UkDropdownButton(UkIcon('more',0.5),
# btn_cls=UkButtonT.secondary,
# options=(P('Content filter preferences',cls=TextT.muted_sm), UkHSplit(),
# P('Delete preset',cls=(TextT.muted_sm,'uk-text-danger'))
# ))
# )
# return UkNavbar(lnav=UkH3('Playground'),

# rnav=rnav)

# %% ../ex_nbs/07_playground.ipynb 12
def playground_navbar():
save_modal = Modal(
UkModalTitle("Save preset"),
P("This will save the current playground state as a preset which you can access later or share with others.",cls=("mt-1.5", TextT.muted_sm)),
UkInput(label="Name", id="name"),
UkInput(label="Description", id="description"),
UkButton("Save", cls=(UkButtonT.primary, "uk-modal-close")),
id="save")

share_dd = Div(cls="space-y-6")(
UkH3("Share preset"),
P("Anyone who has this link and an OpenAI account will be able to view this.", cls=TextT.muted_sm),
Div(cls='flex space-x-2')(
UkInput(value="https://platform.openai.com/playground/p/7bbKYQvsVkNmVb8NGcdUOLae?model=text-davinci-003", readonly=True, cls="flex-1"),
UkButton(UkIcon('copy'), cls=(UkButtonT.primary, "uk-drop-close"))))#flex items-center space-x-2 pt-4 bbmx-6 my-6

rnav = Div(cls='flex items-center space-x-2')(
UkSelect(*["Grammatical Standard English", "Hi"],
name='preset',
optgroup_label="Examples",
placeholder='Load a preset',
searchable=True,
cls='h-9 w-[200px] lg:w-[300px]'),
UkButton("Save", cls=UkButtonT.secondary),
UkSelect(*Options(*preset_options), name='preset', optgroup_label="Examples",
placeholder='Load a preset', searchable=True, cls='h-9 w-[200px] lg:w-[300px]'),
UkButton("Save", cls=UkButtonT.secondary, uk_toggle="#save"),
save_modal,
UkButton("View Code", cls=UkButtonT.secondary),
UkButton("Share", cls=UkButtonT.secondary),
UkDropdownButton(UkIcon('ellipsis'),
btn_cls=UkButtonT.secondary,
options=(
A("Content filter preferences", href="#demo"),
None, # divider
A("Delete preset", cls="text-destructive", href="#demo")
)
)
)
return Div(cls="flex h-16 items-center justify-between border-b border-border px-8 py-4")(
UkH2("Playground", cls="text-lg font-semibold"),
Div(cls="flex w-full flex-1 items-center justify-end")(rnav)
)

# Comment: This implementation assumes that the Modal components for "Save" and "View Code"
# are defined elsewhere and can be toggled using the uk-toggle attribute.

# %% ../ex_nbs/07_playground.ipynb 14
from fasthtml.common import *
from fh_frankenui.components import *
UkDropdownButton(label="Share",options=(share_dd,), btn_cls=UkButtonT.secondary,dd_cls='p-6'),
UkDropdownButton(UkIcon('ellipsis'), btn_cls=UkButtonT.secondary,
options=(A("Content filter preferences", href="#demo"), None, # divider
A("Delete preset", cls="text-destructive", href="#demo"))))

return UkNavbar(lnav=UkH4('Playground'),rnav=rnav,cls='p-2')

# %% ../ex_nbs/07_playground.ipynb 11
def page():
navbar = playground_navbar()

Expand Down Expand Up @@ -109,5 +82,5 @@ def page():
bottom_buttons
)

# %% ../ex_nbs/07_playground.ipynb 15
# %% ../ex_nbs/07_playground.ipynb 12
playground_homepage = page()
Loading

0 comments on commit 8915b7e

Please sign in to comment.