Deploy an Age-Guessing Website

Make a website that guesses people’s ages from their names.

In[]:=
CloudDeploy[FormFunction[{"name","Enter name"}"GivenName",​​Row[{"You are probably ",#name["MostCommonAge"]," old"}]&,"PNG"],Permissions->"Public"]
Out[]=
CloudObject[
https://www.wolframcloud.com/obj/fb4159d4-f47d-4e81-a391-565989abe089
]
Specify the name in a URL query string rather than in a form:
In[]:=
CloudDeploy[APIFunction[{"name""GivenName"},​​Row[{"You are probably ",#name["MostCommonAge"]," old"}]&,"PNG"],Permissions->"Public"]
Out[]=
CloudObject[
https://www.wolframcloud.com/obj/0b858f00-05c7-41ab-8a52-cfba93fcda9e
]

How it works

This example was live-coded at the Wolfram Research booth at SXSW, March 11, 2014.
The “MostCommonAge” predictor for given names is built into the Wolfram Language. It analyzes statistical distributions of ages to determine the most common age for a given name:
In[]:=
=[erin given name]["MostCommonAge"]
Out[]=
35
yr
Make a website that gives the most common age of a name entered into a form. Click the link in the resulting
CloudObject
to visit the website:
In[]:=
form=CloudDeploy[FormFunction[{"name","Enter name"}"GivenName",​​Row[{"You are probably ",#name["MostCommonAge"]," old"}]&,"PNG"],Permissions->"Public"]
Out[]=
CloudObject[
https://www.wolframcloud.com/obj/c149d9fe-fc64-42ed-a849-05bcea72e79a
]
Alternatively, you can make a URL whose query string specifies the name:
In[]:=
api=CloudDeploy[APIFunction[{"name""GivenName"},​​Row[{"You are probably ",#name["MostCommonAge"]," old"}]&,​​"PNG"],Permissions->"Public"]
Out[]=
CloudObject[
https://www.wolframcloud.com/obj/772ba6ca-024f-4a28-b47c-c337b7ddf356
]
This link visits the URL with the name “Erin”:
In[]:=
Hyperlink[api[[1]]<>"?name=Erin"]
Out[]=
https://www.wolframcloud.com/obj/772ba6ca-024f-4a28-b47c-c337b7ddf356?name=Erin