Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -434,14 +434,14 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 434 |
|
| 435 |
match f.type:
|
| 436 |
case 'checkbox':
|
| 437 |
-
st.checkbox(
|
| 438 |
|
| 439 |
case 'radio':
|
| 440 |
labels = (f.other_params.get('labels')
|
| 441 |
if f.other_params and f.other_params.get('labels')
|
| 442 |
else default_labels)
|
| 443 |
st.radio(
|
| 444 |
-
|
| 445 |
options=range(len(labels)),
|
| 446 |
format_func=lambda x: labels[x],
|
| 447 |
key=key,
|
|
@@ -451,7 +451,7 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 451 |
)
|
| 452 |
|
| 453 |
case 'slider':
|
| 454 |
-
st.slider(
|
| 455 |
value=value, help=help_text)
|
| 456 |
|
| 457 |
case 'select_slider':
|
|
@@ -459,7 +459,7 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 459 |
if f.other_params and f.other_params.get('labels')
|
| 460 |
else default_labels)
|
| 461 |
st.select_slider(
|
| 462 |
-
|
| 463 |
options=[0, 20, 40, 60, 80, 100],
|
| 464 |
format_func=lambda x: labels[x // 20],
|
| 465 |
key=key,
|
|
@@ -472,7 +472,7 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 472 |
if f.other_params and f.other_params.get('choices')
|
| 473 |
else default_choices)
|
| 474 |
st.multiselect(
|
| 475 |
-
|
| 476 |
options=choices,
|
| 477 |
format_func=lambda x: x,
|
| 478 |
key=key,
|
|
@@ -486,7 +486,7 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 486 |
if f.other_params and f.other_params.get('labels')
|
| 487 |
else default_labels)
|
| 488 |
st.radio(
|
| 489 |
-
|
| 490 |
options=[0, 1, 2, 3, 4],
|
| 491 |
format_func=lambda x: labels[x],
|
| 492 |
key=key,
|
|
@@ -500,7 +500,7 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 500 |
if f.other_params and f.other_params.get('labels')
|
| 501 |
else yes_no_labels)
|
| 502 |
st.radio(
|
| 503 |
-
|
| 504 |
options=[0, 1],
|
| 505 |
format_func=lambda x: labels[x],
|
| 506 |
key=key,
|
|
@@ -510,11 +510,11 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 510 |
)
|
| 511 |
|
| 512 |
case 'text':
|
| 513 |
-
st.text_input(
|
| 514 |
max_chars=None, help=help_text)
|
| 515 |
|
| 516 |
case 'textarea':
|
| 517 |
-
st.text_area(
|
| 518 |
max_chars=None, help=help_text)
|
| 519 |
|
| 520 |
|
|
|
|
| 434 |
|
| 435 |
match f.type:
|
| 436 |
case 'checkbox':
|
| 437 |
+
st.checkbox(label, key=key, value=value, help=help_text)
|
| 438 |
|
| 439 |
case 'radio':
|
| 440 |
labels = (f.other_params.get('labels')
|
| 441 |
if f.other_params and f.other_params.get('labels')
|
| 442 |
else default_labels)
|
| 443 |
st.radio(
|
| 444 |
+
label,
|
| 445 |
options=range(len(labels)),
|
| 446 |
format_func=lambda x: labels[x],
|
| 447 |
key=key,
|
|
|
|
| 451 |
)
|
| 452 |
|
| 453 |
case 'slider':
|
| 454 |
+
st.slider(label, min_value=0, max_value=6, step=1, key=key,
|
| 455 |
value=value, help=help_text)
|
| 456 |
|
| 457 |
case 'select_slider':
|
|
|
|
| 459 |
if f.other_params and f.other_params.get('labels')
|
| 460 |
else default_labels)
|
| 461 |
st.select_slider(
|
| 462 |
+
label,
|
| 463 |
options=[0, 20, 40, 60, 80, 100],
|
| 464 |
format_func=lambda x: labels[x // 20],
|
| 465 |
key=key,
|
|
|
|
| 472 |
if f.other_params and f.other_params.get('choices')
|
| 473 |
else default_choices)
|
| 474 |
st.multiselect(
|
| 475 |
+
label,
|
| 476 |
options=choices,
|
| 477 |
format_func=lambda x: x,
|
| 478 |
key=key,
|
|
|
|
| 486 |
if f.other_params and f.other_params.get('labels')
|
| 487 |
else default_labels)
|
| 488 |
st.radio(
|
| 489 |
+
label,
|
| 490 |
options=[0, 1, 2, 3, 4],
|
| 491 |
format_func=lambda x: labels[x],
|
| 492 |
key=key,
|
|
|
|
| 500 |
if f.other_params and f.other_params.get('labels')
|
| 501 |
else yes_no_labels)
|
| 502 |
st.radio(
|
| 503 |
+
label,
|
| 504 |
options=[0, 1],
|
| 505 |
format_func=lambda x: labels[x],
|
| 506 |
key=key,
|
|
|
|
| 510 |
)
|
| 511 |
|
| 512 |
case 'text':
|
| 513 |
+
st.text_input(label, key=key, value=(value if value is not None else ""),
|
| 514 |
max_chars=None, help=help_text)
|
| 515 |
|
| 516 |
case 'textarea':
|
| 517 |
+
st.text_area(label, key=key, value=(value if value is not None else ""),
|
| 518 |
max_chars=None, help=help_text)
|
| 519 |
|
| 520 |
|