Py.Cafe

popcorn1939/

solara-click-tracker

Reactive Click Tracker with Color Change

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import solara

# Define the main `Page` component as required by Solara
@solara.component
def Page():
    # Initialize state
    selected_text, set_selected_text = solara.use_state("")

    # Function to update the state when the input changes
    def update_text(value):
        set_selected_text(f"Prediction: {value}")

    # UI: Input field and display the prediction text
    solara.InputText(label="Enter Text", on_value=update_text)
    solara.Markdown(f"Result: {selected_text}")