master
ml server 2020-01-26 21:02:41 -07:00
parent 54b53d217a
commit 6f3b4daab4
1 changed files with 43 additions and 46 deletions

View File

@ -69,9 +69,7 @@
"minobsid = 1292461\n",
"maxobsid = 1470525\n",
"#maxobsid = 1591638\n",
"base_dir = ('/srv/wut/data')\n",
"sample_dir = ('/srv/wut/data/test/unvetted')\n",
"model_file = os.path.join(base_dir, 'models', 'wut-DUV-201912.tf')"
"base_dir = ('/srv/wut/data')"
]
},
{
@ -94,18 +92,6 @@
"#site_intro()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def wut_model(model_file):\n",
" model = load_model(model_file)\n",
" \n",
" return model"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -160,7 +146,7 @@
"metadata": {},
"outputs": [],
"source": [
"def obs_wutsay(test_data_gen):\n",
"def obs_wutsay(test_data_gen, model):\n",
" prediction = model.predict(\n",
" x=test_data_gen,\n",
" verbose=0)\n",
@ -202,6 +188,30 @@
" return obs_var"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def wutObs(datObs, showwater):\n",
" if int(datObs) > ( minobsid - 1 ) and int(datObs) < ( maxobsid + 1):\n",
" doallthethings(datObs, showwater)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def wut_model(txmode):\n",
" model_file = os.path.join(base_dir, 'models', (txmode), 'wut-train-cluster.tf')\n",
" model = load_model(model_file)\n",
" \n",
" return model"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -214,10 +224,13 @@
" obs_waterfallpic=os.path.basename(obs_waterfall)\n",
" obs_waterfalltmp = os.path.join('/srv/satnogs/download', str(get_obs_var('id', datObs)), obs_waterfallpic)\n",
"\n",
" txmode='DUV'\n",
" model=wut_model(txmode)\n",
" \n",
" test_dir=gen_image_tmp(obs_waterfalltmp, showwater);\n",
" test_data_gen=gen_image(obs_waterfalltmp, test_dir);\n",
" \n",
" prediction_bool=obs_wutsay(test_data_gen);\n",
" prediction_bool=obs_wutsay(test_data_gen, model);\n",
"\n",
" print()\n",
" print('Observation ID: ', get_obs_var('id', datObs))\n",
@ -236,7 +249,7 @@
" print()\n",
" print('https://network.satnogs.org/observations/' + str(get_obs_var('id', datObs)))\n",
" #!cat $obsjsonfile\n",
" rm_image_tmp(test_dir) "
" rm_image_tmp(test_dir)"
]
},
{
@ -245,18 +258,7 @@
"metadata": {},
"outputs": [],
"source": [
"def wutObs(datObs, showwater):\n",
" if int(datObs) > ( minobsid - 1 ) and int(datObs) < ( maxobsid + 1):\n",
" doallthethings(datObs, showwater)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def display_main(model):\n",
"def display_main():\n",
" print('Enter an Observation ID between', minobsid, 'and', maxobsid)\n",
" rand_obsid=random.randint(minobsid,maxobsid)\n",
" wutObs_slide = wg.IntText(value=rand_obsid, description=' ')\n",
@ -270,7 +272,7 @@
"metadata": {},
"outputs": [],
"source": [
"model=wut_model(model_file)"
"head_pic()"
]
},
{
@ -279,21 +281,16 @@
"metadata": {},
"outputs": [],
"source": [
"header=head_pic()\n",
"left_side=site_intro()\n",
"right_side=display_main(model)\n",
"#image=('/srv/satnogs/satnogs-wut/pics/wut-web.png')\n",
"image=None\n",
"footer=None\n",
"center=None\n",
"AppLayout(header=header,\n",
" left_sidebar=left_side,\n",
" center=image,\n",
" right_sidebar=right_side,\n",
" footer=footer,\n",
" grid_gap='20px',\n",
" justify_items='center',\n",
" align_items='center')"
"site_intro()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display_main()"
]
}
],