in experiments/babel/app/pages/gemini_studio.py [0:0]
def gemini_studio_page(app_state: me.state):
"""Gemini Studio page"""
state = me.state(PageState)
# print(f"{state.current_page}")
# with me.box(style=me.Style(flex_direction="row", display="flex")):
with me.box(style=CONTENT_STYLE):
me.text("Enter text to voice", type="headline-6")
with me.box(
style=me.Style(
display="flex",
flex_direction="row",
gap=3,
align_items="flex-start",
padding=me.Padding(bottom=16),
)
):
me.image(
src=state.gemini_reference_voice_image_uri,
style=me.Style(height=56),
)
voice_options = []
gemini_voices.sort()
for voice in gemini_voices:
voice_options.append(me.SelectOption(label=voice, value=voice,))
me.select(
label="Select a Gemini Voice",
options=voice_options,
on_selection_change=on_click_set_gemini_voice,
value=state.gemini_voice,
)
subtle_chat_input_gemini()
if state.is_loading:
me.progress_spinner()
elif state.gemini_output_metadata:
with me.box(
style=me.Style(display="grid", grid_template_columns="1fr 1fr")
):
sorted_metadata = sorted(
state.gemini_output_metadata,
key=lambda voice: voice["language_code"],
)
for item in sorted_metadata:
# print(item)
audio_url = f"{BUCKET_PATH}/{item['audio_path']}"
# print(audio_url)
with me.box(
style=me.Style(
display="flex",
flex_direction="column",
gap=5,
padding=me.Padding(top=10, left=10, right=10, bottom=12),
)
):
me.text(
f"{item["voice_name"]}",
style=me.Style(font_weight="bold"),
)
me.audio(src=audio_url)
me.text(item["text"])