mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
added flag to output txt file with data
This commit is contained in:
parent
4cdf622c06
commit
901b2a87d2
@ -374,7 +374,7 @@
|
||||
"text": [
|
||||
"NOTE: Gradio is in beta stage, please report all bugs to: a12d@stanford.edu\n",
|
||||
"Model is running locally at: http://localhost:7860/interface.html\n",
|
||||
"Unable to create public link for interface, please check internet connection.\n"
|
||||
"Model available publicly for 8 hours at: https://share.gradio.app/fabb2fe8\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -391,7 +391,7 @@
|
||||
" "
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.lib.display.IFrame at 0x1e4e20431d0>"
|
||||
"<IPython.lib.display.IFrame at 0x1ab3a87ad68>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
@ -121,6 +121,11 @@ class Interface:
|
||||
'data': processed_output,
|
||||
}
|
||||
await websocket.send(json.dumps(output))
|
||||
if msg['action'] == 'flag':
|
||||
f = open('gradio-flagged.txt','a+')
|
||||
f.write(str(msg['data']))
|
||||
f.close()
|
||||
|
||||
except websockets.exceptions.ConnectionClosed:
|
||||
pass
|
||||
# except Exception as e:
|
||||
|
@ -64,12 +64,12 @@ $('body').on('click', '.submit', function(e) {
|
||||
maxHeight: 360,
|
||||
fillColor: "white"
|
||||
}).toDataURL();
|
||||
var ws_data = {
|
||||
'action': 'input',
|
||||
'data': src
|
||||
}
|
||||
var ws_data = {
|
||||
'action': 'input',
|
||||
'data': src
|
||||
}
|
||||
|
||||
ws.send(JSON.stringify(ws_data), function(e) {
|
||||
notifyError(e)
|
||||
ws.send(JSON.stringify(ws_data), function(e) {
|
||||
notifyError(e)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -34,13 +34,23 @@ $('body').on('click', '.clear', function(e) {
|
||||
$(".confidence_intervals").empty()
|
||||
})
|
||||
|
||||
// $('body').on('click', '.flag', function(e) {
|
||||
// src = cropper.getCroppedCanvas({
|
||||
// maxWidth: 360,
|
||||
// maxHeight: 360,
|
||||
// fillColor: "white"
|
||||
// }).toDataURL();
|
||||
// ws.send(src, function(e) {
|
||||
// notifyError(e)
|
||||
// })
|
||||
// })
|
||||
$('body').on('click', '.flag', function(e) {
|
||||
src = cropper.getCroppedCanvas({
|
||||
maxWidth: 360,
|
||||
maxHeight: 360,
|
||||
fillColor: "white"
|
||||
}).toDataURL();
|
||||
var ws_data = {
|
||||
'action': 'flag',
|
||||
'data': {
|
||||
'input': src,
|
||||
'output': data,
|
||||
'message': "This was flagged because..",
|
||||
'timestamp': new Date(),
|
||||
}
|
||||
}
|
||||
|
||||
ws.send(JSON.stringify(ws_data), function(e) {
|
||||
notifyError(e)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user