updated PyPi version

This commit is contained in:
Ali Abid 2020-08-25 09:42:35 -07:00
parent b8279ba14c
commit fdfe069b07
4 changed files with 2 additions and 117 deletions

View File

@ -1,43 +0,0 @@
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
None, in which case the caller has nothing further to do.
"""
path = self.translate_path(self.path)
f = None
if os.path.isdir(path):
if not self.path.endswith('/'):
# redirect browser - doing basically what apache does
self.send_response(301)
self.send_header("Location", self.path + "/")
self.end_headers()
return None
for index in "index.html", "index.htm":
index = os.path.join(path, index)
if os.path.exists(index):
path = index
break
else:
return self.list_directory(path)
ctype = self.guess_type(path)
try:
# Always read in binary mode. Opening files in text mode may cause
# newline translations, making the actual size of the content
# transmitted *less* than the content-length!
f = open(path, 'rb')
except IOError:
self.send_error(404, "File not found")
return None
self.send_response(200)
self.send_header("Content-type", ctype)
fs = os.fstat(f.fileno())
self.send_header("Content-Length", str(fs[6]))
self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
self.send_header("Access-Control-Allow-Origin", "*")
self.end_headers()
return f

View File

@ -1,72 +0,0 @@
import json
from gradio.inputs import InputComponent
from gradio.outputs import OutputComponent
from gradio.interface import Interface
import inspect
def get_params(func):
params_str = inspect.getdoc(func)
params_doc = []
documented_params = {"self"}
for param_line in params_str.split("\n")[1:]:
if param_line.strip() == "Returns":
break
space_index = param_line.index(" ")
colon_index = param_line.index(":")
name = param_line[:space_index]
documented_params.add(name)
params_doc.append((name, param_line[space_index+2:colon_index-1], param_line[colon_index+2:]))
params = inspect.getfullargspec(func)
param_set = []
for i in range(len(params.args)):
neg_index = -1 - i
if params.args[neg_index] not in documented_params:
continue
if i < len(params.defaults):
default = params.defaults[neg_index]
if type(default) == str:
default = '"' + default + '"'
else:
default = str(default)
param_set.insert(0, (params.args[neg_index], default))
else:
param_set.insert(0, (params.args[neg_index],))
return param_set, params_doc
def document(cls_set):
docset = []
for cls in cls_set:
inp = {}
inp["name"] = cls.__name__
doc = inspect.getdoc(cls)
if doc.startswith("DEPRECATED"):
continue
inp["doc"] = "\n".join(doc.split("\n")[:-1])
inp["type"] = doc.split("\n")[-1].split("type: ")[-1]
inp["params"], inp["params_doc"] = get_params(cls.__init__)
inp["shortcuts"] = list(cls.get_shortcut_implementations().items())
docset.append(inp)
return docset
inputs = document(InputComponent.__subclasses__())
outputs = document(OutputComponent.__subclasses__())
interface_params = get_params(Interface.__init__)
interface = {
"doc": inspect.getdoc(Interface),
"params": interface_params[0],
"params_doc": interface_params[1],
}
launch_params = get_params(Interface.launch)
launch = {
"params": launch_params[0],
"params_doc": launch_params[1],
}
with open("docs.json", "w") as docs:
json.dump({
"inputs": inputs,
"outputs": outputs,
"interface": interface,
"launch": launch
}, docs)

View File

@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: gradio
Version: 1.1.6
Version: 1.1.7
Summary: Python library for easily interacting with trained machine learning models
Home-page: https://github.com/gradio-app/gradio-UI
Author: Abubakar Abid

View File

@ -5,7 +5,7 @@ except ImportError:
setup(
name='gradio',
version='1.1.6',
version='1.1.7',
include_package_data=True,
description='Python library for easily interacting with trained machine learning models',
author='Abubakar Abid',