Menu

1 / 6

Adding UI to Google Colab: forms, sliders, buttons and more

DEV Community·Daisuke Majima·5 months ago
#LcS4JJ7X
#dev#big#middle#little#output
Reading 0:00
15s threshold

Adding UI to Colab

You can show UI in a Google Colaboratory notebook. Input forms, buttons, and so on are handy when other people use your notebook. A form's value is reflected into the cell's variable.

Live Colab notebook sample

Cell title

#@title cell title

Enter fullscreen mode

Exit fullscreen mode

Input form

You can reflect the form's content into a variable in the cell.

variable = " the form is reflected into the variable " #@param {type:"string"} # for a number: #@param {type:"number"}

Enter fullscreen mode

Exit fullscreen mode

Select box

dropdown = ' value ' #@param ["1st option", "2nd option", "3rd option"] {allow-input: true}

Enter fullscreen mode

Exit fullscreen mode

Date input

date_input = ' 2018-03-22 ' #@param {type:"date"}

Enter fullscreen mode

Exit fullscreen mode

Slider

number_slider = 0.1 #@param {type:"slider", min:-1, max:1, step:0.1}

Enter fullscreen mode

Exit fullscreen mode

Checkbox

boolean_checkbox = True #@param {type:"boolean"}

Enter fullscreen mode

Exit…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.