diff --git a/notebooks/wut-web-dev.ipynb b/notebooks/wut-web-dev.ipynb index 7e83ff0..6f9f499 100644 --- a/notebooks/wut-web-dev.ipynb +++ b/notebooks/wut-web-dev.ipynb @@ -20,6 +20,7 @@ "import tensorflow as tf\n", "import numpy as np\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", "from ipywidgets import interact, interactive, fixed, interact_manual\n", @@ -82,6 +83,7 @@ "metadata": {}, "outputs": [], "source": [ + "%%capture\n", "n=0\n", "random.seed();\n", "for root, dirs, files in os.walk(sample_dir):\n", @@ -98,8 +100,17 @@ "metadata": {}, "outputs": [], "source": [ - "model = load_model(model_file)\n", - "\n", + "%%capture\n", + "model = load_model(model_file)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%capture\n", "test_image_generator = ImageDataGenerator(\n", " rescale=1./255\n", ")\n", @@ -107,24 +118,52 @@ " 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", - "if prediction_bool[0] == False:\n", - " rating = 'bad'\n", - "else:\n", - " rating = 'good'\n", - "print('Observation: %s' % (rating))\n", - "\n", + "predictions = prediction_bool.astype(int)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "shutil.rmtree(test_dir)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "waterfallpng=os.path.basename(rfile)\n", + "print('Random waterfall:', waterfallpng)\n", + "f=text.EvalFormatter()\n", + "obsid=(f.format(\"{waterfall[slice(10,17)]}\", waterfall=waterfallpng))\n", + "print('Observation URL: https://network.satnogs.org/observations/{}'.format(obsid))\n", + "if prediction_bool[0] == False:\n", + " rating = 'BAD'\n", + "else:\n", + " rating = 'GOOD'\n", + "print('AI Observation rating: %s' % (rating))" + ] + }, { "cell_type": "code", "execution_count": null, @@ -401,6 +440,25 @@ "print(text.marquee('wut?',40,'*'))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "a = input()\n", + "print(a)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print('mkay')" + ] + }, { "cell_type": "code", "execution_count": null,