update README to use 0.5.0 (#3313)

This commit is contained in:
Thomas Brandého 2024-05-18 01:29:38 +02:00 committed by GitHub
parent 9ba179410b
commit 590d86ebf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,14 +120,15 @@ def index():
on_blur=State.set_prompt, on_blur=State.set_prompt,
width="25em", width="25em",
), ),
rx.button("Generate Image", on_click=State.get_image, width="25em"), rx.button(
"Generate Image",
on_click=State.get_image,
width="25em",
loading=State.processing
),
rx.cond( rx.cond(
State.processing, State.complete,
rx.chakra.circular_progress(is_indeterminate=True), rx.image(src=State.image_url, width="20em"),
rx.cond(
State.complete,
rx.image(src=State.image_url, width="20em"),
),
), ),
align="center", align="center",
), ),
@ -185,7 +186,7 @@ class State(rx.State):
The state defines all the variables (called vars) in an app that can change and the functions that change them. The state defines all the variables (called vars) in an app that can change and the functions that change them.
Here the state is comprised of a `prompt` and `image_url`. There are also the booleans `processing` and `complete` to indicate when to show the circular progress and image. Here the state is comprised of a `prompt` and `image_url`. There are also the booleans `processing` and `complete` to indicate when to disable the button (during image generation) and when to show the resulting image.
### **Event Handlers** ### **Event Handlers**