From ec40409dd0a483d6ffd05fca32f069ce0bfd8a1e Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Sun, 28 Apr 2019 23:25:37 -0700 Subject: [PATCH] changes --- Demo Gradio.ipynb | 40 +++++++++++++++-- Test Keras MNIST.ipynb | 97 +++++++++++++++++++++++++----------------- Test Keras.ipynb | 53 +++++++++++++++-------- gradio/strings.py | 2 +- 4 files changed, 130 insertions(+), 62 deletions(-) diff --git a/Demo Gradio.ipynb b/Demo Gradio.ipynb index 852a2913dd..6b64121184 100644 --- a/Demo Gradio.ipynb +++ b/Demo Gradio.ipynb @@ -49,18 +49,50 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": { "scrolled": false }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Validating samples: 6/6 [======]\n", + "\n", + "Validation passed successfully!\n", + "Closing existing server...\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Exception in thread Thread-6:\n", + "Traceback (most recent call last):\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\threading.py\", line 916, in _bootstrap_inner\n", + " self.run()\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\threading.py\", line 864, in run\n", + " self._target(*self._args, **self._kwargs)\n", + " File \"C:\\Users\\islam\\Repos\\gradio\\gradio\\networking.py\", line 253, in serve_forever\n", + " httpd.serve_forever()\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\socketserver.py\", line 236, in serve_forever\n", + " ready = selector.select(poll_interval)\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\selectors.py\", line 323, in select\n", + " r, w, _ = self._select(self._readers, self._writers, [], timeout)\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\selectors.py\", line 314, in _select\n", + " r, w, x = select.select(r, w, w, timeout)\n", + "OSError: [WinError 10038] An operation was attempted on something that is not a socket\n", + "\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ "NOTE: Gradio is in beta stage, please report all bugs to: gradio.app@gmail.com\n", "Model is running locally at: http://localhost:7863/\n", - "Model available publicly at: https://48771.gradio.app\n" + "Model available publicly at: https://21378.gradio.app\n" ] }, { @@ -77,7 +109,7 @@ " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -85,7 +117,7 @@ } ], "source": [ - "io.launch(inline=True, share=True, validate=False);" + "io.launch(inline=True, share=True, validate=True);" ] } ], diff --git a/Test Keras MNIST.ipynb b/Test Keras MNIST.ipynb index aed05ed22f..72dfe9ce8f 100644 --- a/Test Keras MNIST.ipynb +++ b/Test Keras MNIST.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -47,14 +47,22 @@ "name": "stdout", "output_type": "stream", "text": [ - "Epoch 1/1\n", - "60000/60000 [==============================] - 24s 407us/step - loss: 0.2171 - acc: 0.9355\n" + "Epoch 1/5\n", + "60000/60000 [==============================] - 28s 463us/step - loss: 0.2181 - acc: 0.9353\n", + "Epoch 2/5\n", + "60000/60000 [==============================] - 29s 481us/step - loss: 0.0972 - acc: 0.9704\n", + "Epoch 3/5\n", + "60000/60000 [==============================] - 29s 476us/step - loss: 0.0676 - acc: 0.97861s - los\n", + "Epoch 4/5\n", + "60000/60000 [==============================] - 29s 488us/step - loss: 0.0538 - acc: 0.9827\n", + "Epoch 5/5\n", + "60000/60000 [==============================] - 26s 433us/step - loss: 0.0431 - acc: 0.9857\n" ] }, { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 4, @@ -63,7 +71,7 @@ } ], "source": [ - "model.fit(x_train, y_train, epochs=1)" + "model.fit(x_train, y_train, epochs=5)" ] }, { @@ -77,17 +85,45 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "No validation samples for this interface... skipping validation.\n", - "NOTE: Gradio is in beta stage, please report all bugs to: contact.gradio@gmail.com\n", - "Model is running locally at: http://localhost:7860/\n", - "To create a public link, set `share=True` in the argument to `launch()`\n" + "Closing existing server...\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Exception in thread Thread-6:\n", + "Traceback (most recent call last):\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\threading.py\", line 916, in _bootstrap_inner\n", + " self.run()\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\threading.py\", line 864, in run\n", + " self._target(*self._args, **self._kwargs)\n", + " File \"C:\\Users\\islam\\Repos\\gradio\\gradio\\networking.py\", line 253, in serve_forever\n", + " httpd.serve_forever()\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\socketserver.py\", line 236, in serve_forever\n", + " ready = selector.select(poll_interval)\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\selectors.py\", line 323, in select\n", + " r, w, _ = self._select(self._readers, self._writers, [], timeout)\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\selectors.py\", line 314, in _select\n", + " r, w, x = select.select(r, w, w, timeout)\n", + "OSError: [WinError 10038] An operation was attempted on something that is not a socket\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NOTE: Gradio is in beta stage, please report all bugs to: gradio.app@gmail.com\n", + "Model is running locally at: http://localhost:7861/\n", + "Model available publicly at: https://30540.gradio.app (may take up to a minute for link to be usable)\n" ] }, { @@ -97,14 +133,14 @@ " \n", " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -113,45 +149,26 @@ { "data": { "text/plain": [ - "(.HTTPServer at 0x23bf9174b70>,\n", - " 'http://localhost:7860/',\n", - " None)" + "(.HTTPServer at 0x2006e4d6e10>,\n", + " 'http://localhost:7861/',\n", + " 'https://30540.gradio.app')" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Error in connection handler\n", - "Traceback (most recent call last):\n", - " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\websockets\\server.py\", line 169, in handler\n", - " yield from self.ws_handler(self, path)\n", - " File \"C:\\Users\\islam\\Repos\\gradio\\gradio\\interface.py\", line 114, in communicate\n", - " msg = json.loads(await websocket.recv())\n", - " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\json\\__init__.py\", line 354, in loads\n", - " return _default_decoder.decode(s)\n", - " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\json\\decoder.py\", line 339, in decode\n", - " obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n", - " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\json\\decoder.py\", line 357, in raw_decode\n", - " raise JSONDecodeError(\"Expecting value\", s, err.value) from None\n", - "json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n" - ] } ], "source": [ - "iface.launch(inline=True, share=False)" + "iface.launch(inline=True, share=True)" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.6 (tensorflow)", "language": "python", - "name": "python3" + "name": "tensorflow" }, "language_info": { "codemirror_mode": { @@ -163,7 +180,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.1" + "version": "3.6.7" } }, "nbformat": 4, diff --git a/Test Keras.ipynb b/Test Keras.ipynb index 395d603003..24f058c563 100644 --- a/Test Keras.ipynb +++ b/Test Keras.ipynb @@ -9,18 +9,9 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 1, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The autoreload extension is already loaded. To reload it, use:\n", - " %reload_ext autoreload\n" - ] - } - ], + "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", @@ -65,10 +56,38 @@ "name": "stdout", "output_type": "stream", "text": [ - "Closing existing server...\n", + "Closing existing server...\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Exception in thread Thread-7:\n", + "Traceback (most recent call last):\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\threading.py\", line 916, in _bootstrap_inner\n", + " self.run()\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\threading.py\", line 864, in run\n", + " self._target(*self._args, **self._kwargs)\n", + " File \"C:\\Users\\islam\\Repos\\gradio\\gradio\\networking.py\", line 253, in serve_forever\n", + " httpd.serve_forever()\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\socketserver.py\", line 236, in serve_forever\n", + " ready = selector.select(poll_interval)\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\selectors.py\", line 323, in select\n", + " r, w, _ = self._select(self._readers, self._writers, [], timeout)\n", + " File \"C:\\Users\\islam\\Anaconda3\\envs\\tensorflow\\lib\\selectors.py\", line 314, in _select\n", + " r, w, x = select.select(r, w, w, timeout)\n", + "OSError: [WinError 10038] An operation was attempted on something that is not a socket\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ "NOTE: Gradio is in beta stage, please report all bugs to: gradio.app@gmail.com\n", - "Model is running locally at: http://localhost:7863/\n", - "Model available publicly at: https://25024.gradio.app -- may take up to a minute to setup.\n" + "Model is running locally at: http://localhost:7860/\n", + "Model available publicly at: https://53279.gradio.app (may take up to a minute for link to be usable)\n" ] }, { @@ -78,14 +97,14 @@ " \n", " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -93,7 +112,7 @@ } ], "source": [ - "io.launch(inline=True, validate=False);" + "io.launch(inline=True, validate=False, share=True);" ] } ], diff --git a/gradio/strings.py b/gradio/strings.py index 9280dd2e91..1fc88f28ef 100644 --- a/gradio/strings.py +++ b/gradio/strings.py @@ -5,6 +5,6 @@ en = { "restarting python interpreter.", "COLAB_NO_LOCAL": "Cannot display local interface on google colab, public link created.", "PUBLIC_SHARE_TRUE": "To create a public link, set `share=True` in the argument to `launch()`.", - "MODEL_PUBLICLY_AVAILABLE_URL": "Model available publicly at: {}", + "MODEL_PUBLICLY_AVAILABLE_URL": "Model available publicly at: {} (may take up to a minute for link to be usable)", "GENERATING_PUBLIC_LINK": "Generating public link (may take a few seconds...):", }