wut-web-dev cruft input tests wtf

master
ml server 2020-01-23 19:22:39 -07:00
parent f87a677b19
commit 7c9eb3cf32
1 changed files with 72 additions and 6 deletions

View File

@ -20,9 +20,7 @@
"from IPython.display import display, Image\n",
"from IPython.utils import text\n",
"from tensorflow.python.keras.models import load_model\n",
"from tensorflow.python.keras.preprocessing.image import ImageDataGenerator\n",
"\n",
"display(Image(filename='/srv/satnogs/satnogs-wut/pics/spacecruft-bk.png'))"
"from tensorflow.python.keras.preprocessing.image import ImageDataGenerator"
]
},
{
@ -31,8 +29,76 @@
"metadata": {},
"outputs": [],
"source": [
"%%HTML\n",
"<H1><B>wut?<B></H1>"
"#display(Image(filename='/srv/satnogs/satnogs-wut/pics/spacecruft-bk.png'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as w\n",
"from IPython.display import display\n",
"import time\n",
"from jupyter_ui_poll import (\n",
" ui_events, \n",
" with_ui_events,\n",
" run_ui_poll_loop\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"t0 = time.time()\n",
"xx = ['-_-', 'o_o']\n",
"\n",
"def on_poll():\n",
" \"\"\" This is called repeatedly by run_ui_poll_loop\n",
" \n",
" Return None if condition hasn't been met yet\n",
" \n",
" Return some result once done, in this example result \n",
" is a number of seconds it took to press the button 10 times.\n",
" \"\"\"\n",
" if int(btn.description) < 10:\n",
" print(xx[0], end='\\r', flush=True)\n",
" xx[:] = xx[::-1]\n",
" return None # Continue polling\n",
" \n",
" # Terminate polling and return final result\n",
" return time.time() - t0\n",
"\n",
"btn = test_button()\n",
"print('Press button 10 times')\n",
"display(btn)\n",
"\n",
"dt = run_ui_poll_loop(on_poll, 1/15)\n",
"print('._.') # This should display the text in the output of this cell\n",
"n_times = '10 times' # To verify that the rest of this cell executes before executing cells below"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(f'Took {dt:.1f} seconds to click {n_times}')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#%%HTML\n",
"#<H1><B>wut?<B></H1>"
]
},
{
@ -152,7 +218,7 @@
"metadata": {},
"outputs": [],
"source": [
"display(Image(filename=rfile, width=300))"
"#display(Image(filename=rfile, width=300))"
]
}
],