diff --git a/notebooks/wut-web.ipynb b/notebooks/wut-web.ipynb index 9222d93..773b629 100644 --- a/notebooks/wut-web.ipynb +++ b/notebooks/wut-web.ipynb @@ -18,6 +18,7 @@ "import shutil\n", "import tensorflow as tf\n", "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", @@ -53,6 +54,7 @@ "metadata": {}, "outputs": [], "source": [ + "%%capture\n", "n=0\n", "random.seed();\n", "for root, dirs, files in os.walk(sample_dir):\n", @@ -69,6 +71,7 @@ "metadata": {}, "outputs": [], "source": [ + "%%capture\n", "model = load_model(model_file)\n", "\n", "test_image_generator = ImageDataGenerator(\n", @@ -78,21 +81,50 @@ " directory=test_dir,\n", " target_size=(IMG_HEIGHT, IMG_WIDTH),\n", " shuffle=True,\n", - " class_mode='binary')\n", - "\n", + " class_mode='binary')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%capture\n", "prediction = model.predict(\n", " x=test_data_gen,\n", " verbose=0\n", ")\n", "predictions=[]\n", "prediction_bool = (prediction >0.8)\n", - "predictions = prediction_bool.astype(int)\n", + "predictions = prediction_bool.astype(int)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "waterfallpng=os.path.basename(rfile)\n", + "print(waterfallpng)\n", + "f=text.EvalFormatter()\n", + "obsid=(f.format(\"{waterfall[slice(10,17)]}\", waterfall=waterfallpng))\n", + "print('https://network.satnogs.org/observations/{}'.format(obsid))\n", "if prediction_bool[0] == False:\n", " rating = 'bad'\n", "else:\n", " rating = 'good'\n", - "print('Observation: %s' % (rating))\n", - "\n", + "print('Observation: %s' % (rating))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%capture\n", "shutil.rmtree(test_dir)" ] },