mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-06 12:30:29 +08:00
testing
This commit is contained in:
parent
eb2f141326
commit
8686e57066
@ -50,7 +50,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"NOTE: Gradio is in beta stage, please report all bugs to: a12d@stanford.edu\n",
|
||||
"NOTE: Gradio is in beta2 stage, please report all bugs to: a12d@stanford.edu\n",
|
||||
"Model available locally at: http://localhost:7861/interface.html\n",
|
||||
"To create a public link, set `share_link=True` in the argument to `launch()`\n"
|
||||
]
|
||||
@ -59,159 +59,20 @@
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /interface.html HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /js/all-io.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /css/bootstrap.min.css HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /css/draw-a-digit.css HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /js/bootstrap.min.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /js/bootstrap-notify.min.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /js/textbox-input.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:01] \"GET /js/textbox-output.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /interface.html HTTP/1.1\" 304 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /js/all-io.js HTTP/1.1\" 304 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /css/bootstrap.min.css HTTP/1.1\" 304 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /css/draw-a-digit.css HTTP/1.1\" 304 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /js/bootstrap.min.js HTTP/1.1\" 304 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /js/bootstrap-notify.min.js HTTP/1.1\" 304 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /js/textbox-input.js HTTP/1.1\" 304 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:06:35] \"GET /js/textbox-output.js HTTP/1.1\" 304 -\n"
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:36] \"GET /interface.html HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:36] \"GET /js/all-io.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:36] \"GET /css/bootstrap.min.css HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:37] \"GET /css/draw-a-digit.css HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:37] \"GET /js/bootstrap.min.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:37] \"GET /js/bootstrap-notify.min.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:37] \"GET /js/textbox-output.js HTTP/1.1\" 200 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 22:21:37] \"GET /js/textbox-input.js HTTP/1.1\" 200 -\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"iface.launch()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Model type not explicitly identified, inferred to be: python function\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"iface2 = gradio.Interface(input=\"textbox\", output=\"textbox\", model=test)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Model type not explicitly identified, inferred to be: python function\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"iface = gradio.Interface(input=\"textbox\", output=\"textbox\", model=test)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] code 404, message File not found\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] \"GET /css/bootstrap.min.css HTTP/1.1\" 404 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] code 404, message File not found\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] \"GET /css/index.css HTTP/1.1\" 404 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] code 404, message File not found\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] \"GET /js/bootstrap.min.js HTTP/1.1\" 404 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] code 404, message File not found\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] \"GET /img/draw-a-digit.png HTTP/1.1\" 404 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] code 404, message File not found\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] \"GET /js/bootstrap.min.js HTTP/1.1\" 404 -\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] code 404, message File not found\n",
|
||||
"127.0.0.1 - - [24/Feb/2019 21:50:49] \"GET /img/placeholder.png HTTP/1.1\" 404 -\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#!/bin/env python\n",
|
||||
"import sys, signal\n",
|
||||
"import http.server\n",
|
||||
"import socketserver\n",
|
||||
"import threading\n",
|
||||
"\n",
|
||||
"port = 7865\n",
|
||||
"\n",
|
||||
"# Note ForkingTCPServer does not work on Windows as the os.fork() \n",
|
||||
"# function is not available on that OS. Instead we must use the \n",
|
||||
"# subprocess server to handle multiple requests\n",
|
||||
"server = socketserver.ThreadingTCPServer(('localhost',port), http.server.SimpleHTTPRequestHandler )\n",
|
||||
"\n",
|
||||
"#Ensures that Ctrl-C cleanly kills all spawned threads\n",
|
||||
"server.daemon_threads = True \n",
|
||||
"#Quicker rebinding\n",
|
||||
"server.allow_reuse_address = True \n",
|
||||
"\n",
|
||||
"# A custom signal handle to allow us to Ctrl-C out of the process\n",
|
||||
"def signal_handler(signal, frame):\n",
|
||||
" print( 'Exiting http server (Ctrl+C pressed)')\n",
|
||||
" try:\n",
|
||||
" if(server):\n",
|
||||
" server.server_close()\n",
|
||||
" finally:\n",
|
||||
" sys.exit(0)\n",
|
||||
"\n",
|
||||
"# Install the keyboard interrupt handler\n",
|
||||
"signal.signal(signal.SIGINT, signal_handler)\n",
|
||||
"\n",
|
||||
"# Now loop forever\n",
|
||||
"def serve_forever():\n",
|
||||
" try:\n",
|
||||
" while True:\n",
|
||||
" sys.stdout.flush()\n",
|
||||
" server.serve_forever()\n",
|
||||
" except KeyboardInterrupt:\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"thread = threading.Thread(target=serve_forever)\n",
|
||||
"thread.start()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import socket\n",
|
||||
"\n",
|
||||
"s = socket.socket() \n",
|
||||
"s.bind(('localhost', 7866))\n",
|
||||
"s.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"1+1"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
@ -178,7 +178,7 @@ class Interface():
|
||||
start_server = websockets.serve(self.communicate, LOCALHOST_IP, INITIAL_WEBSOCKET_PORT + i)
|
||||
self._set_socket_port_in_js(output_directory, INITIAL_WEBSOCKET_PORT + i)
|
||||
if verbose:
|
||||
print("NOTE: Gradio is in beta stage, please report all bugs to: a12d@stanford.edu")
|
||||
print("NOTE: Gradio is in beta2 stage, please report all bugs to: a12d@stanford.edu")
|
||||
print("Model available locally at: {}".format(path_to_server + TEMPLATE_TEMP))
|
||||
|
||||
if share_link:
|
||||
|
Loading…
x
Reference in New Issue
Block a user