diff --git a/Demo Gradio.ipynb b/Demo Gradio.ipynb
new file mode 100644
index 0000000000..557c4020b1
--- /dev/null
+++ b/Demo Gradio.ipynb
@@ -0,0 +1,126 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Load the Model"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%load_ext autoreload\n",
+ "%autoreload 2\n",
+ "\n",
+ "import numpy as np\n",
+ "import tensorflow as tf\n",
+ "import gradio"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "model = tf.keras.applications.inception_v3.InceptionV3()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "inp = gradio.inputs.ImageUpload()\n",
+ "out = gradio.outputs.Label(label_names='imagenet1000', max_label_length=8)\n",
+ "\n",
+ "io = gradio.Interface(inputs=inp, \n",
+ " outputs=out,\n",
+ " model=model, \n",
+ " model_type='keras')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Closing existing server...\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",
+ "Model available publicly for 8 hours at: https://a5853afe.gradio.app/\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ " "
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "flagged\n"
+ ]
+ }
+ ],
+ "source": [
+ "io.launch(inline=True, inbrowser=True, share=True, validate=False);"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3.6 (tensorflow)",
+ "language": "python",
+ "name": "tensorflow"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/Test Keras.ipynb b/Test Keras.ipynb
index 953c4bbbaa..89a33c1c2c 100644
--- a/Test Keras.ipynb
+++ b/Test Keras.ipynb
@@ -25,17 +25,7 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "WARNING:tensorflow:From C:\\Users\\ALI\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\ops\\resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
- "Instructions for updating:\n",
- "Colocations handled automatically by placer.\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"model = tf.keras.applications.inception_v3.InceptionV3()"
]
@@ -44,7 +34,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# Feed An Image Into the Model Manually"
+ "# Using Gradio"
]
},
{
@@ -52,44 +42,6 @@
"execution_count": 3,
"metadata": {},
"outputs": [],
- "source": [
- "# from PIL import Image\n",
- "# import requests\n",
- "# from io import BytesIO\n",
- "\n",
- "# url = 'https://nationalzoo.si.edu/sites/default/files/animals/cheetah-004.jpg'\n",
- "\n",
- "# response = requests.get(url)\n",
- "# img = Image.open(BytesIO(response.content))\n",
- "\n",
- "# # resize the image into an array that the model can accept\n",
- "# img = np.array(img.resize((299, 299))).reshape((1, 299, 299, 3))\n",
- "\n",
- "# # scale the image and do other preprocessing\n",
- "# img = img/255"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [],
- "source": [
- "# model.predict(img)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Use Gradio Instead"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [],
"source": [
"inp = gradio.inputs.ImageUpload(shape=(299,299,3))\n",
"out = gradio.outputs.Label(label_names='imagenet1000', max_label_length=8)\n",
@@ -102,17 +54,18 @@
},
{
"cell_type": "code",
- "execution_count": 20,
- "metadata": {},
+ "execution_count": 4,
+ "metadata": {
+ "scrolled": false
+ },
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Closing existing server...\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",
- "Unable to create public link for interface, please check internet connection or try restarting python interpreter.\n"
+ "Model available publicly for 8 hours at: https://c0097190.gradio.app/\n"
]
},
{
@@ -129,7 +82,7 @@
" "
],
"text/plain": [
- ""
+ ""
]
},
"metadata": {},
@@ -139,20 +92,13 @@
"source": [
"io.launch(inline=True, inbrowser=False, share=True, validate=False);"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "Python 3.6 (tensorflow)",
"language": "python",
- "name": "python3"
+ "name": "tensorflow"
},
"language_info": {
"codemirror_mode": {
@@ -164,7 +110,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.7.1"
+ "version": "3.6.7"
}
},
"nbformat": 4,
diff --git a/gradio/static/img/logo_loading.gif b/gradio/static/img/logo_loading.gif
new file mode 100644
index 0000000000..9d1786980a
Binary files /dev/null and b/gradio/static/img/logo_loading.gif differ
diff --git a/gradio/static/img/logo_only.png b/gradio/static/img/logo_only.png
new file mode 100644
index 0000000000..63106b9eb4
Binary files /dev/null and b/gradio/static/img/logo_only.png differ
diff --git a/gradio/static/js/interfaces/output/image.js b/gradio/static/js/interfaces/output/image.js
index 6de44e6c5f..f9955589b5 100644
--- a/gradio/static/js/interfaces/output/image.js
+++ b/gradio/static/js/interfaces/output/image.js
@@ -7,6 +7,7 @@ const image_output = {
this.target.find(".output_image").attr('src', data).show();
},
submit: function() {
+ this.target.find(".output_image").attr('src', 'static/img/logo_loading.gif').show();
},
clear: function() {
this.target.find(".output_image").attr('src', "").hide();
diff --git a/gradio/static/js/interfaces/output/label.js b/gradio/static/js/interfaces/output/label.js
index 197bb5e579..c05cc031bb 100644
--- a/gradio/static/js/interfaces/output/label.js
+++ b/gradio/static/js/interfaces/output/label.js
@@ -20,6 +20,7 @@ const label_output = {
}
},
submit: function() {
+ this.target.find(".output_class").html("
")
},
clear: function() {
this.target.find(".output_class").empty();
diff --git a/web/img/logo.png b/web/img/logo.png
index a5f739eec0..c5ad888f90 100644
Binary files a/web/img/logo.png and b/web/img/logo.png differ
diff --git a/web/img/logo_only.png b/web/img/logo_only.png
new file mode 100644
index 0000000000..63106b9eb4
Binary files /dev/null and b/web/img/logo_only.png differ