diff --git a/Test Keras.ipynb b/Test Keras.ipynb
index a8b4d8ddbe..cc665319ff 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",
@@ -32,9 +23,19 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 2,
"metadata": {},
- "outputs": [],
+ "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"
+ ]
+ }
+ ],
"source": [
"model = tf.keras.applications.inception_v3.InceptionV3()"
]
@@ -48,7 +49,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -64,9 +65,7 @@
{
"cell_type": "code",
"execution_count": 14,
- "metadata": {
- "scrolled": false
- },
+ "metadata": {},
"outputs": [
{
"name": "stdout",
@@ -74,7 +73,7 @@
"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:7861/\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"
]
},
@@ -85,14 +84,14 @@
" \n",
" "
],
"text/plain": [
- ""
+ ""
]
},
"metadata": {},
@@ -101,17 +100,35 @@
{
"data": {
"text/plain": [
- "''"
+ "(.HTTPServer at 0x25256cb1080>,\n",
+ " 'http://localhost:7860/',\n",
+ " None)"
]
},
"execution_count": 14,
"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\\ALI\\Anaconda3\\lib\\site-packages\\websockets\\server.py\", line 169, in handler\n",
+ " yield from self.ws_handler(self, path)\n",
+ " File \"C:\\Users\\ALI\\Desktop\\gradiome\\gradio\\interface.py\", line 139, in communicate\n",
+ " self.input_interface.rebuild_flagged(msg)\n",
+ " File \"C:\\Users\\ALI\\Desktop\\gradiome\\gradio\\inputs.py\", line 223, in rebuild_flagged\n",
+ " sniffer = csv.Sniffer().sniff(f.readline())\n",
+ " File \"C:\\Users\\ALI\\Anaconda3\\lib\\csv.py\", line 188, in sniff\n",
+ " raise Error(\"Could not determine delimiter\")\n",
+ "_csv.Error: Could not determine delimiter\n"
+ ]
}
],
"source": [
- "io.launch(inline=True, inbrowser=False, share=True, validate=False)\n",
- ";"
+ "io.launch(inline=True, inbrowser=False, share=True, validate=False)"
]
},
{
diff --git a/gradio/inputs.py b/gradio/inputs.py
index 7684468c0c..dde128463e 100644
--- a/gradio/inputs.py
+++ b/gradio/inputs.py
@@ -10,6 +10,7 @@ import numpy as np
from PIL import Image, ImageOps
import datetime
import csv
+import pandas as pd
# Where to find the static resources associated with each template.
BASE_INPUT_INTERFACE_TEMPLATE_PATH = 'templates/input/{}.html'
@@ -211,9 +212,18 @@ class ImageUpload(AbstractInput):
im = preprocessing_utils.encoding_to_image(inp)
timestamp = datetime.datetime.now()
im.save(f'gradio-flagged/{timestamp.strftime("%Y-%m-%d %H-%M-%S")}.png', 'PNG')
+
f = open('gradio-flagged/gradio-flagged.csv','a+')
+ header = ['Gradio flag output: Records filename (timestamp) and associated output, as well confidences and second top two outputs (if they exist)']
+ columns = ['Filename (timestamp)','Label','Confidence','Label','Confidence','Label','Confidence']
fields = [timestamp.strftime("%Y-%m-%d %H-%M-%S"),msg['data']['output']]
writer = csv.writer(f)
+ # df = pd.read_csv('gradio-flagged/gradio-flagged.csv')
+ # if df.empty:
+ # sniffer = csv.Sniffer().sniff(f.readline())
+ # if sniffer.has_header(f.read(32)):
+ # writer.writerow(header)
+ # writer.writerow(columns)
writer.writerow(fields)
f.close()